Skip to content

Conversation

@timfish
Copy link
Collaborator

@timfish timfish commented Dec 11, 2025

This PR:

  • Moves propagateTraceparent to base options
  • Adds traceparent support to the Otel getTraceData
  • Add header in http and fetch integrations
  • Add header in propagator
  • Tests both node and node-core

Closes #18465

@github-actions
Copy link
Contributor

github-actions bot commented Dec 11, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.81 kB - -
@sentry/browser - with treeshaking flags 23.3 kB - -
@sentry/browser (incl. Tracing) 41.55 kB -0.01% -3 B 🔽
@sentry/browser (incl. Tracing, Profiling) 46.15 kB -0.01% -2 B 🔽
@sentry/browser (incl. Tracing, Replay) 79.97 kB -0.01% -4 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.7 kB -0.01% -6 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 84.65 kB -0.01% -4 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 96.89 kB -0.01% -5 B 🔽
@sentry/browser (incl. Feedback) 41.52 kB - -
@sentry/browser (incl. sendFeedback) 29.49 kB - -
@sentry/browser (incl. FeedbackAsync) 34.48 kB - -
@sentry/react 26.52 kB - -
@sentry/react (incl. Tracing) 43.76 kB -0.02% -5 B 🔽
@sentry/vue 29.27 kB - -
@sentry/vue (incl. Tracing) 43.36 kB -0.01% -4 B 🔽
@sentry/svelte 24.82 kB - -
CDN Bundle 27.23 kB -0.03% -7 B 🔽
CDN Bundle (incl. Tracing) 42.22 kB -0.02% -8 B 🔽
CDN Bundle (incl. Tracing, Replay) 78.75 kB -0.01% -7 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 84.2 kB -0.01% -6 B 🔽
CDN Bundle - uncompressed 80.02 kB -0.02% -16 B 🔽
CDN Bundle (incl. Tracing) - uncompressed 125.37 kB -0.02% -16 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 241.41 kB -0.01% -16 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 254.17 kB -0.01% -16 B 🔽
@sentry/nextjs (client) 45.98 kB -0.01% -4 B 🔽
@sentry/sveltekit (client) 41.93 kB -0.02% -5 B 🔽
@sentry/node-core 51.6 kB +0.2% +98 B 🔺
@sentry/node 160.43 kB +0.08% +120 B 🔺
@sentry/node - without tracing 93.03 kB +0.13% +116 B 🔺
@sentry/aws-serverless 108.54 kB +0.1% +107 B 🔺

View base workflow run

@github-actions

This comment was marked as outdated.

Copy link
Member

@Lms24 Lms24 left a 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 :)

@timfish timfish marked this pull request as ready for review December 15, 2025 16:59
Copy link

@cursor cursor bot left a 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

*/
public fields(): string[] {
return [SENTRY_TRACE_HEADER, SENTRY_BAGGAGE_HEADER];
}

Fix in Cursor Fix in Web


@timfish timfish requested a review from Lms24 December 15, 2025 17:50
public fields(): string[] {
return [SENTRY_TRACE_HEADER, SENTRY_BAGGAGE_HEADER];
return [SENTRY_TRACE_HEADER, SENTRY_BAGGAGE_HEADER, 'traceparent'];
}
Copy link

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.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for propagateTraceparent in Node.js

3 participants