Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the custom attributes #225

Merged
merged 3 commits into from
Dec 16, 2024
Merged

Conversation

kibertoad
Copy link
Collaborator

Changes

This implements a new method on the transactionObservabilityManager

Checklist

  • Apply one of following labels; major, minor, patch or skip-release
  • I've updated the documentation, or no changes were necessary
  • I've updated the tests, or no changes were necessary

@kibertoad kibertoad requested review from CarlosGamero, drdaemos and a team as code owners December 15, 2024 14:19
@@ -50,6 +51,17 @@ export class NewRelicTransactionManager implements TransactionObservabilityManag
newrelic.addCustomAttribute(attrName, attrValue)
}

public addCustomAttributes(
_uniqueTransactionKey: string,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signature of the method still includes this parameter because other implementations (Prometheus, OpenTelemetry etc) will need it

const transactionName = this.transactionNameByKey.get(uniqueTransactionKey)
if (!transactionName) return

// @ts-expect-error We only enforce types lightly here. If this ever causes us problem, we can start doing runtime validation here, but it seems to be an overkill for now.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we also should extend the interface of TransactionObservabilityManager to have a generic for customAttribute keys, but that could be a future improvement

[
'# HELP myMetric this is my first metric',
'# TYPE myMetric counter',
'myMetric{status="started",transactionName="myTransaction"} 1',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we would need to change the signature of the base interface start method if we want to make it possible to also include custom attributes there. maybe we should do that after we have the first use-case for it

@kibertoad kibertoad merged commit 2ab290b into main Dec 16, 2024
4 checks passed
@kibertoad kibertoad deleted the feat/custom-attributes2 branch December 16, 2024 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants