-
Notifications
You must be signed in to change notification settings - Fork 421
Open
Labels
points: 3A few daysA few days
Milestone
Description
While implementing #3474, I missed that the Span object has an .addLink method to allow adding of links during the lifetime of the span. The implementation for #3474 handles the links present at creation of the span. While it is recommended to only add links at creation, the reality is that links can be added subsequent to creation and we need to account for those.
We need to update our span onStart method to intercept the .addLink method on the span to handle in-flight links. It will likely look something like:
onStart(span) {
span[otelSynthesis] = this.synthesizer.synthesize(span)
const { segment } = span[otelSynthesis]
const addLink = span.addLink
span.addLink = function nrAddLink(link) {
const nrLink = new SpanLink({ link, context: span.spanContext(), timestamp: span.startTime })
segment.addSpanLink(nrLink)
addLink.call(span, link)
}
const addLinks = span.addLinks
span.addLinks = function nrAddLinks(links) {
for (const link of links) { span.addLink(link) }
}
}node-newrelic/lib/otel/traces/span-processor.js
Lines 42 to 44 in ae0074b
| onStart(span) { | |
| span[otelSynthesis] = this.synthesizer.synthesize(span) | |
| } |
Metadata
Metadata
Assignees
Labels
points: 3A few daysA few days
Type
Projects
Status
To do: In current sprint