Skip to content

fix(browser): Propagate trace data from active span if http.client span is non-recording#22246

Open
Lms24 wants to merge 1 commit into
developfrom
lms/fix-browser-active-span-http-client-non-recording
Open

fix(browser): Propagate trace data from active span if http.client span is non-recording#22246
Lms24 wants to merge 1 commit into
developfrom
lms/fix-browser-active-span-http-client-non-recording

Conversation

@Lms24

@Lms24 Lms24 commented Jul 14, 2026

Copy link
Copy Markdown
Member

This PR fixes an inconsistency with trace propagation via browser http.client spans: If an http.client span was started as a NonRecordingSpan we'd still take it as the span we generate our tracing headers from (via getTraceData). What we should do instead is to propagate the currently active span, so that span trees from a downstream service don't become orphaned.

This PR also adds integration tests for 3 scenarios with ignoreSpans:

  • ignoring a segment span should force a negative sampling decision on propagation, even if the incoming trace is sampled positively
  • ignoring a child span should continue the segment span's sampling decision on propagation
  • akin: ignoring an http.client span should still continue the positive sampling decision on propagation

ref: #22262

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.65 kB - -
@sentry/browser - with treeshaking flags 26.1 kB - -
@sentry/browser (incl. Tracing) 46.48 kB +0.13% +57 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 48.27 kB +0.12% +57 B 🔺
@sentry/browser (incl. Tracing, Profiling) 51.25 kB +0.11% +55 B 🔺
@sentry/browser (incl. Tracing, Replay) 85.71 kB +0.05% +42 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.35 kB +0.06% +40 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 90.43 kB +0.05% +44 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 103.08 kB +0.05% +42 B 🔺
@sentry/browser (incl. Feedback) 44.83 kB - -
@sentry/browser (incl. sendFeedback) 32.45 kB - -
@sentry/browser (incl. FeedbackAsync) 37.58 kB - -
@sentry/browser (incl. Metrics) 28.74 kB - -
@sentry/browser (incl. Logs) 28.98 kB - -
@sentry/browser (incl. Metrics & Logs) 29.67 kB - -
@sentry/react 29.45 kB - -
@sentry/react (incl. Tracing) 48.72 kB +0.1% +46 B 🔺
@sentry/vue 33.08 kB - -
@sentry/vue (incl. Tracing) 48.44 kB +0.1% +45 B 🔺
@sentry/svelte 27.67 kB - -
CDN Bundle 30.05 kB - -
CDN Bundle (incl. Tracing) 48.44 kB +0.08% +36 B 🔺
CDN Bundle (incl. Logs, Metrics) 31.64 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.74 kB +0.08% +37 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 70.87 kB - -
CDN Bundle (incl. Tracing, Replay) 85.93 kB +0.04% +33 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.24 kB +0.04% +32 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 91.73 kB +0.04% +30 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93 kB +0.04% +29 B 🔺
CDN Bundle - uncompressed 89.58 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.38 kB +0.04% +48 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.29 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.35 kB +0.04% +48 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.02 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.58 kB +0.02% +48 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.54 kB +0.02% +48 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.29 kB +0.02% +48 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.23 kB +0.02% +48 B 🔺
@sentry/nextjs (client) 51.27 kB +0.1% +47 B 🔺
@sentry/sveltekit (client) 46.9 kB +0.09% +38 B 🔺
@sentry/core/server 78.49 kB +0.03% +17 B 🔺
@sentry/core/browser 64.84 kB +0.03% +18 B 🔺
@sentry/node-core 62.79 kB +0.01% +2 B 🔺
@sentry/node 125.2 kB - -
@sentry/node (incl. diagnostics channel injection) 139.87 kB -0.01% -1 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.96 kB - -
@sentry/node/light 50.8 kB - -
@sentry/node - without tracing 74.17 kB +0.01% +1 B 🔺
@sentry/aws-serverless 83.39 kB +0.01% +1 B 🔺
@sentry/cloudflare (withSentry) - minified 181.82 kB +0.02% +24 B 🔺
@sentry/cloudflare (withSentry) 450.07 kB +0.03% +95 B 🔺

View base workflow run

@Lms24 Lms24 marked this pull request as ready for review July 14, 2026 13:11
@Lms24 Lms24 requested a review from a team as a code owner July 14, 2026 13:11
@Lms24 Lms24 requested review from logaretm, msonnb and mydea and removed request for a team July 14, 2026 13:11
@Lms24 Lms24 changed the title fix(browser): Propagate trace data from active span if http.client span is not recording fix(browser): Propagate trace data from active span if http.client span is not recording Jul 14, 2026
@Lms24 Lms24 self-assigned this Jul 14, 2026
@Lms24 Lms24 changed the title fix(browser): Propagate trace data from active span if http.client span is not recording fix(browser): Propagate trace data from active span if http.client span is non-recording Jul 15, 2026
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.

1 participant