-
Notifications
You must be signed in to change notification settings - Fork 404
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
feat: Added otel consumer span processing #2834
Conversation
6363baa
to
f3a0d1f
Compare
… and enterTransaction to make context propagation more clear (newrelic#2646)
…client otel spans to external http trace segments (newrelic#2745)
a201e19
to
7334acb
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #2834 +/- ##
===========================================
- Coverage 97.26% 79.24% -18.02%
===========================================
Files 294 287 -7
Lines 46405 45542 -863
===========================================
- Hits 45135 36091 -9044
- Misses 1270 9451 +8181
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
lib/otel/segments/consumer.js
Outdated
const destination = otelSpan.attributes[SEMATTRS_MESSAGING_DESTINATION] ?? 'unknown' | ||
const segmentName = `OtherTransaction/consumer/${operation}/${destination}` | ||
|
||
transaction.trace.attributes.addAttribute( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's more logic in the subscribe-consume for adding other segment and trace attributes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good test, specific to amqplib but should apply to all but obviously the destination kind and destination vary: https://github.com/newrelic/node-newrelic/blob/main/test/versioned/amqplib/amqp-utils.js#L103
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this one. Is there a document somewhere that clearly lists out the attribute names and expected values that are required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you know the answer to that question 😄
test('should create consumer segment from otel span', (t) => { | ||
const { synth, tracer } = t.nr | ||
const span = createSpan({ tracer, kind: SpanKind.CONSUMER }) | ||
span.setAttribute('messaging.operation', 'receive') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test will have to be updated once the feedback is addressed for the new name and also attributes
424f32b
to
b2c4033
Compare
b2c4033
to
39716e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to resolve merge conflicts. Regarding the tx and segment attributes you can either try to figure out now or we can reconcile later
|
||
const txAttrs = transaction.trace.attributes | ||
txAttrs.addAttribute(DESTINATIONS.TRANS_SCOPE, 'message.queueName', destination) | ||
// txAttrs.addAttribute( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove this. All the other attributes seem to be all over the place. I'm not sure if we have access to host/port in the otel spans. Then the message.parameters
attributes vary depending on the library. Same with message.routingKey
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at amqplib a lot of the parameters live on these span attributes:
[SemanticAttributes.MESSAGING_DESTINATION]: exchange,
[SemanticAttributes.MESSAGING_DESTINATION_KIND]:
MessagingDestinationKindValues.TOPIC,
[SemanticAttributes.MESSAGING_RABBITMQ_ROUTING_KEY]:
msg.fields?.routingKey,
[SemanticAttributes.MESSAGING_OPERATION]:
MessagingOperationValues.PROCESS,
[SemanticAttributes.MESSAGING_MESSAGE_ID]:
msg?.properties.messageId,
[SemanticAttributes.MESSAGING_CONVERSATION_ID]:
msg?.properties.correlationId,
26f5ea2
to
fe95d98
Compare
This PR resolves #2651.