Skip to content

feat(node): Expose headersToSpanAttributes option on nativeNodeFetchIntegration#19770

Merged
andreiborza merged 1 commit intodevelopfrom
ab/expose-headers-to-span-attributes
Mar 12, 2026
Merged

feat(node): Expose headersToSpanAttributes option on nativeNodeFetchIntegration#19770
andreiborza merged 1 commit intodevelopfrom
ab/expose-headers-to-span-attributes

Conversation

@andreiborza
Copy link
Member

Allows users to configure which HTTP request/response headers are captured as span attributes on fetch/undici spans. This was previously captured automatically for content-length but is now opt-in since @opentelemetry/instrumentation-unidici@0.22.0.

…chIntegration`

Allows users to configure which HTTP request/response headers are
captured as span attributes on fetch/undici spans. This was previously
captured automatically for `content-length` but is now opt-in since
[@opentelemetry/instrumentation-unidici@0.22.0](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/packages/instrumentation-undici/CHANGELOG.md#0220-2026-02-16).
@andreiborza andreiborza force-pushed the ab/expose-headers-to-span-attributes branch from e0c70ba to a4d2283 Compare March 11, 2026 20:21
@github-actions
Copy link
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 25.64 kB - -
@sentry/browser - with treeshaking flags 24.14 kB - -
@sentry/browser (incl. Tracing) 42.62 kB - -
@sentry/browser (incl. Tracing, Profiling) 47.28 kB - -
@sentry/browser (incl. Tracing, Replay) 81.42 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 71 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 86.12 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 98.37 kB - -
@sentry/browser (incl. Feedback) 42.45 kB - -
@sentry/browser (incl. sendFeedback) 30.31 kB - -
@sentry/browser (incl. FeedbackAsync) 35.36 kB - -
@sentry/browser (incl. Metrics) 26.92 kB - -
@sentry/browser (incl. Logs) 27.07 kB - -
@sentry/browser (incl. Metrics & Logs) 27.74 kB - -
@sentry/react 27.39 kB - -
@sentry/react (incl. Tracing) 44.95 kB - -
@sentry/vue 30.08 kB - -
@sentry/vue (incl. Tracing) 44.48 kB - -
@sentry/svelte 25.66 kB - -
CDN Bundle 28.27 kB - -
CDN Bundle (incl. Tracing) 43.5 kB - -
CDN Bundle (incl. Logs, Metrics) 29.13 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 44.34 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 68.2 kB - -
CDN Bundle (incl. Tracing, Replay) 80.32 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81.22 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 85.86 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.76 kB - -
CDN Bundle - uncompressed 82.56 kB - -
CDN Bundle (incl. Tracing) - uncompressed 128.5 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 85.43 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 131.37 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 209.06 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 245.35 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 248.21 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 258.26 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 261.11 kB - -
@sentry/nextjs (client) 47.37 kB - -
@sentry/sveltekit (client) 43.07 kB - -
@sentry/node-core 52.27 kB +0.02% +6 B 🔺
@sentry/node 172.1 kB -1.73% -3.02 kB 🔽
@sentry/node - without tracing 94.59 kB -2.91% -2.83 kB 🔽
@sentry/aws-serverless 110.13 kB -2.74% -3.1 kB 🔽

View base workflow run

@github-actions
Copy link
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 11,454 - 8,639 +33%
GET With Sentry 1,961 17% 1,596 +23%
GET With Sentry (error only) 7,547 66% 5,927 +27%
POST Baseline 1,286 - 1,177 +9%
POST With Sentry 632 49% 556 +14%
POST With Sentry (error only) 1,141 89% 1,037 +10%
MYSQL Baseline 3,478 - 3,311 +5%
MYSQL With Sentry 390 11% 499 -22%
MYSQL With Sentry (error only) 2,865 82% 2,678 +7%

View base workflow run

@andreiborza andreiborza requested review from JPeer264 and removed request for isaacs March 11, 2026 20:48
@andreiborza andreiborza merged commit 89e787a into develop Mar 12, 2026
292 of 294 checks passed
@andreiborza andreiborza deleted the ab/expose-headers-to-span-attributes branch March 12, 2026 10:24
Copilot AI added a commit to getsentry/sentry-for-ai that referenced this pull request Mar 17, 2026
…etchIntegration

Addresses skill drift from getsentry/sentry-javascript#19770.
The nativeNodeFetchIntegration() now accepts headersToSpanAttributes
to capture specific HTTP headers as span attributes, which became
opt-in after @opentelemetry/instrumentation-undici@0.22.0.

Co-Authored-By: Claude (Anthropic)

Co-authored-by: HazAT <363802+HazAT@users.noreply.github.com>
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.

2 participants