Skip to content

fix(browser): Respect manually set sentry tracing headers in XHR requests #16184

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

Merged
merged 2 commits into from
May 5, 2025

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented May 2, 2025

Analogously to #16183 for fetch, this PR ensures that manually set sentry-trace and baggage headers in XHR requests are respected by our XHR instrumentation and not overwritten.

This also fixes a bug where we'd append multiple sentry-trace or baggage values in case the header was somehow set more than once (analogously to #13907 for fetch)

Added two integration tests to demonstrate correct behaviour.

Came up in https://linear.app/getsentry/issue/FE-380/debug-trace-context-propagation-issue-from-tanstack-to-go-backend

bundle-size wise, this probably amortizes the savings from #16183 🙃

@Lms24 Lms24 self-assigned this May 2, 2025
@Lms24 Lms24 requested review from mydea and chargome May 2, 2025 13:35
Copy link
Contributor

github-actions bot commented May 2, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.32 KB - -
@sentry/browser - with treeshaking flags 23.13 KB - -
@sentry/browser (incl. Tracing) 37.01 KB +0.09% +32 B 🔺
@sentry/browser (incl. Tracing, Replay) 74.19 KB +0.06% +41 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 67.53 KB +0.06% +37 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 78.84 KB +0.06% +42 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 90.63 KB +0.05% +40 B 🔺
@sentry/browser (incl. Feedback) 39.71 KB - -
@sentry/browser (incl. sendFeedback) 27.94 KB - -
@sentry/browser (incl. FeedbackAsync) 32.7 KB - -
@sentry/react 25.12 KB - -
@sentry/react (incl. Tracing) 38.99 KB +0.11% +40 B 🔺
@sentry/vue 27.55 KB - -
@sentry/vue (incl. Tracing) 38.77 KB +0.1% +38 B 🔺
@sentry/svelte 23.34 KB - -
CDN Bundle 24.52 KB - -
CDN Bundle (incl. Tracing) 37.03 KB +0.11% +40 B 🔺
CDN Bundle (incl. Tracing, Replay) 72.07 KB +0.06% +40 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 77.39 KB +0.06% +45 B 🔺
CDN Bundle - uncompressed 71.57 KB - -
CDN Bundle (incl. Tracing) - uncompressed 109.55 KB +0.14% +151 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 220.84 KB +0.07% +151 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 233.36 KB +0.07% +151 B 🔺
@sentry/nextjs (client) 40.59 KB +0.09% +35 B 🔺
@sentry/sveltekit (client) 37.48 KB +0.1% +37 B 🔺
@sentry/node 143.45 KB -0.01% -1 B 🔽
@sentry/node - without tracing 96.54 KB - -
@sentry/aws-serverless 120.86 KB - -

View base workflow run

@Lms24 Lms24 enabled auto-merge (squash) May 5, 2025 12:10
@Lms24 Lms24 merged commit 0335cf7 into develop May 5, 2025
154 checks passed
@Lms24 Lms24 deleted the lms/fix-browser-xhr-manual-sentry-tracing-headers branch May 5, 2025 12:22
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.

3 participants