Title: Option to disable trace propagation in Sentry NodeFetch instrumentation · Issue #19689 · getsentry/sentry-javascript · GitHub
Open Graph Title: Option to disable trace propagation in Sentry NodeFetch instrumentation · Issue #19689 · getsentry/sentry-javascript
X Title: Option to disable trace propagation in Sentry NodeFetch instrumentation · Issue #19689 · getsentry/sentry-javascript
Description: Problem Statement I would like to roll with a custom OpenTelemetry setup with NodeSDK while still using Sentry for both traces and error monitoring. From how I understand the docs, this is how you're supposed to set up both SDKs: const s...
Open Graph Description: Problem Statement I would like to roll with a custom OpenTelemetry setup with NodeSDK while still using Sentry for both traces and error monitoring. From how I understand the docs, this is how you'...
X Description: Problem Statement I would like to roll with a custom OpenTelemetry setup with NodeSDK while still using Sentry for both traces and error monitoring. From how I understand the docs, this is how you&...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/19689
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Option to disable trace propagation in Sentry NodeFetch instrumentation","articleBody":"### Problem Statement\n\nI would like to roll with a custom OpenTelemetry setup with `NodeSDK` while still using Sentry for both traces and error monitoring.\n\nFrom how I understand the docs, this is how you're supposed to set up both SDKs:\n\n```ts\nconst sentry = Sentry.init({ skipOpenTelemetrySetup: true });\n\nnew NodeSDK({\n sampler: new SentrySampler(sentry),\n ...,\n instrumentations: [\n getNodeAutoInstrumentations({})\n ],\n}).start();\n```\n\nThe problem with this is that now both the Sentry NodeFetch and the OTel Undici instrumentation both inject their sentry-trace headers, which ends up setting two `sentry-trace` headers. From how I understand: https://github.com/getsentry/sentry-javascript/blob/5e5487bdd64991d0d191211f3c78c3af02c71053/packages/node-core/src/utils/outgoingFetchRequest.ts#L55-L57, the Sentry instrumentation is supposed to run its hooks _after_ OTel's. I want to keep Sentry's integration for the breadcrumbs and the OTel plugin because it also creates valuable metrics.\n\nHow I solved this:\n\n```ts\nconst sentry = Sentry.init({\n skipOpenTelemetrySetup: true,\n integrations: defaults => [\n ...defaults.filter(i => i.name !== 'Http' && i.name !== 'NodeFetch'),\n Sentry.httpIntegration({\n spans: true,\n }),\n Sentry.nativeNodeFetchIntegration({\n spans: true,\n }),\n ],\n});\n\nnew NodeSDK({\n sampler: new SentrySampler(sentry),\n ...,\n instrumentations: [\n getNodeAutoInstrumentations({\n \"@opentelemetry/instrumentation-http\": {\n enabled: false,\n },\n \"@opentelemetry/instrumentation-undici\": {\n enabled: false,\n },\n }),\n ],\n}).start();\n```\n\nThis setup feels off because we're now using Sentry to initialise some of the OTel instrumentations (and with no way to customise them ourselves). It also requires half a novel in doc comment explaining why exactly we (need to) disable `@opentelemetry/instrumentation-undici` and still get the metrics.\n\n\n### Solution Brainstorm\n\nI might be missing something, but it seems to me that stripping the Sentry instrumentation of all trace propagation logic (so just breadcrumbs) and leaving all of that to the OTel trace propagator instead, would resolve the need for \"first OTel, then Sentry\" (which would allow NodeSDK to set up those instrumentations with custom config instead). Also seems to make sense architecturally to delegate all \"spans\" logic to OTel. If the Sentry SDK is then initialised without skipOTelSetup, it would simply register both the Sentry and OTel integrations in any order, and instead of this patch module: https://github.com/getsentry/sentry-javascript/blob/5e5487bdd64991d0d191211f3c78c3af02c71053/packages/node/src/integrations/node-fetch.ts#L58\ncoupling both integrations and initialisation order, Sentry would simply default to \"Sentry-specific\" constructor options for the OTel Undici instrumentation (which I might also want to include and extend in my custom setup, so consider exporting that function?)\n\n### Additional Context\n\n_No response_\n\n### Priority\n\n\u003csub>React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it.\u003c/sub>","author":{"url":"https://github.com/jeengbe","@type":"Person","name":"jeengbe"},"datePublished":"2026-03-06T19:46:25Z","url":"https://github.com/getsentry/sentry-javascript/issues/19689"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ed648203-a606-f543-ffc2-21ebb5c005a2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D66:1204FD:8622C4:B07A7B:6B04CD99 |
| html-safe-nonce | 66ec72aab7372d9293db3c06159b7472764cd736e26a9dce4466843794ab42a2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDY2OjEyMDRGRDo4NjIyQzQ6QjA3QTdCOjZCMDRDRDk5IiwidmlzaXRvcl9pZCI6IjQ4MjM5MzkwMTc2MTM4MjMzODUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a44fca4c903a7b31397d1ef8d22ab765e113d0e0b7aa5b339bc63d5a4d421909 |
| hovercard-subject-tag | issue:4035875243 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/19689/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4fab4fecd365f01dc334dd3db6eac90fbc3137c90fd3cc24e5c3deabc02c6445/getsentry/sentry-javascript/issues/19689 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4fab4fecd365f01dc334dd3db6eac90fbc3137c90fd3cc24e5c3deabc02c6445/getsentry/sentry-javascript/issues/19689 |
| og:image:alt | Problem Statement I would like to roll with a custom OpenTelemetry setup with NodeSDK while still using Sentry for both traces and error monitoring. From how I understand the docs, this is how you'... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jeengbe |
| hostname | github.com |
| expected-hostname | github.com |
| None | 27ed421e5c2dac040a37529b5b9191edcc4a3de70521471e81fb4b4d9dc2aa7d |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 63dc19014c621c67306d7899c04c78dcd0d95803 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width