-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(node): Support propagateTraceparent
#18476
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
base: develop
Are you sure you want to change the base?
Conversation
size-limit report 📦
|
This comment was marked as outdated.
This comment was marked as outdated.
…etsentry/sentry-javascript into timfish/feat/node-propagateTraceparent
Lms24
left a comment
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.
Thanks! Let's make sure we test this for fetch and http in node-core and node. AFAIK we have a different propagation mechanism for http in node than in node-core. If this is not the case and the tests would be pure duplication, feel free to skip :)
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.
Bug: Propagator fields() doesn't include injected traceparent header
The fields() method returns only sentry-trace and baggage headers, but the propagator now also injects the traceparent header when propagateTraceparent is enabled. According to the OpenTelemetry TextMapPropagator specification, fields() should return all headers that the propagator may potentially modify, which is used for CORS configuration and carrier pre-allocation. Since traceparent can now be injected, it should be included in the returned array. While the PR documentation warns users to configure CORS manually, omitting traceparent from fields() violates the propagator contract and could cause issues for code that relies on this method to determine which headers might be set.
packages/opentelemetry/src/propagator.ts#L121-L124
sentry-javascript/packages/opentelemetry/src/propagator.ts
Lines 121 to 124 in 4134dab
| */ | |
| public fields(): string[] { | |
| return [SENTRY_TRACE_HEADER, SENTRY_BAGGAGE_HEADER]; | |
| } |
| public fields(): string[] { | ||
| return [SENTRY_TRACE_HEADER, SENTRY_BAGGAGE_HEADER]; | ||
| return [SENTRY_TRACE_HEADER, SENTRY_BAGGAGE_HEADER, 'traceparent']; | ||
| } |
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.
Bug: Propagator fields() unconditionally claims conditional header
The fields() method now unconditionally returns 'traceparent' in its array, but the inject() method only actually sets the traceparent header when propagateTraceparent is true. This mismatch between declared fields and actual injection behavior could cause coordination issues with other propagators in a composite setup. When propagateTraceparent is false, the propagator claims ownership of traceparent but never injects it, potentially preventing other propagators from injecting this header.
This PR:
propagateTraceparentto base optionstraceparentsupport to the OtelgetTraceDataCloses #18465