Skip to content

fix(core): Preserve propagation across ignored spans#22277

Open
Lms24 wants to merge 3 commits into
developfrom
lms/fix-node-ative-span-http-client-non-recording
Open

fix(core): Preserve propagation across ignored spans#22277
Lms24 wants to merge 3 commits into
developfrom
lms/fix-node-ative-span-http-client-non-recording

Conversation

@Lms24

@Lms24 Lms24 commented Jul 15, 2026

Copy link
Copy Markdown
Member

This PR preserves trace propagation for ignored spans in span streaming mode:

  • When segment spans are ignored, incoming DSC (via baggage) is kept as-is, but is mutated to carry a negative sampling decision, in line with the sentry-trace header, which already emitted a negative sampling decision
  • ignored child and HTTP client spans propagate from the nearest emitted parent across fetch, node:http
    • For Orchestrion/tracing-channel-based instrumentation, we only set a child span as the active span if it is not ignored. This was already implemented in the OTel context manager previously but probably didn't get ported correctly to the new approach.

Turns out, the DSC changes are also a requirement for #22246, so I threw it on top of this PR.

ref #22262

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.72 kB +0.18% +49 B 🔺
@sentry/browser - with treeshaking flags 26.17 kB +0.19% +48 B 🔺
@sentry/browser (incl. Tracing) 46.48 kB +0.09% +40 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 48.28 kB +0.09% +41 B 🔺
@sentry/browser (incl. Tracing, Profiling) 51.27 kB +0.08% +40 B 🔺
@sentry/browser (incl. Tracing, Replay) 85.73 kB +0.05% +38 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.38 kB +0.06% +44 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 90.44 kB +0.05% +40 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 103.11 kB +0.04% +40 B 🔺
@sentry/browser (incl. Feedback) 44.9 kB +0.11% +46 B 🔺
@sentry/browser (incl. sendFeedback) 32.52 kB +0.15% +46 B 🔺
@sentry/browser (incl. FeedbackAsync) 37.65 kB +0.13% +47 B 🔺
@sentry/browser (incl. Metrics) 28.81 kB +0.16% +46 B 🔺
@sentry/browser (incl. Logs) 29.05 kB +0.17% +47 B 🔺
@sentry/browser (incl. Metrics & Logs) 29.73 kB +0.17% +49 B 🔺
@sentry/react 29.53 kB +0.17% +49 B 🔺
@sentry/react (incl. Tracing) 48.74 kB +0.09% +42 B 🔺
@sentry/vue 33.15 kB +0.13% +42 B 🔺
@sentry/vue (incl. Tracing) 48.46 kB +0.08% +37 B 🔺
@sentry/svelte 27.75 kB +0.19% +50 B 🔺
CDN Bundle 30.12 kB +0.16% +46 B 🔺
CDN Bundle (incl. Tracing) 48.47 kB +0.08% +37 B 🔺
CDN Bundle (incl. Logs, Metrics) 31.7 kB +0.17% +51 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 49.77 kB +0.08% +39 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 70.94 kB +0.08% +50 B 🔺
CDN Bundle (incl. Tracing, Replay) 85.97 kB +0.05% +41 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.28 kB +0.05% +43 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 91.77 kB +0.06% +47 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93.03 kB +0.05% +45 B 🔺
CDN Bundle - uncompressed 89.78 kB +0.09% +80 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 146.53 kB +0.06% +80 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.48 kB +0.09% +80 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.5 kB +0.06% +80 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.21 kB +0.04% +80 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.73 kB +0.04% +80 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.69 kB +0.03% +80 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.43 kB +0.03% +80 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.38 kB +0.03% +80 B 🔺
@sentry/nextjs (client) 51.29 kB +0.1% +47 B 🔺
@sentry/sveltekit (client) 46.93 kB +0.1% +43 B 🔺
@sentry/core/server 78.58 kB +0.05% +37 B 🔺
@sentry/core/browser 64.93 kB +0.06% +36 B 🔺
@sentry/node-core 63.17 kB -0.3% -184 B 🔽
@sentry/node 125.41 kB +0.06% +66 B 🔺
@sentry/node (incl. diagnostics channel injection) 140.46 kB +0.05% +59 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 70.03 kB +0.01% +2 B 🔺
@sentry/node/light 51.3 kB +0.08% +37 B 🔺
@sentry/node - without tracing 74.67 kB +0.04% +23 B 🔺
@sentry/aws-serverless 83.9 kB +0.04% +26 B 🔺
@sentry/cloudflare (withSentry) - minified 181.98 kB +0.05% +76 B 🔺
@sentry/cloudflare (withSentry) 450.49 kB +0.06% +241 B 🔺

View base workflow run

Lms24 and others added 3 commits July 15, 2026 14:48
Keep continued trace sampling data consistent when ignored segment or child
spans are omitted, and propagate from the nearest emitted parent.

Co-Authored-By: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@Lms24 Lms24 self-assigned this Jul 15, 2026
@Lms24

Lms24 commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

@BugBot review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 71c3abc. Configure here.

@Lms24 Lms24 changed the title fix(tracing): Preserve propagation across ignored spans fix(core/node): Preserve propagation across ignored spans Jul 15, 2026
@Lms24 Lms24 changed the title fix(core/node): Preserve propagation across ignored spans fix(core): Preserve propagation across ignored spans Jul 15, 2026
@Lms24 Lms24 marked this pull request as ready for review July 15, 2026 14:34
@Lms24 Lms24 requested review from a team as code owners July 15, 2026 14:34
@Lms24 Lms24 requested review from JPeer264, isaacs and mydea and removed request for a team July 15, 2026 14:34
@Lms24 Lms24 force-pushed the lms/fix-node-ative-span-http-client-non-recording branch from 71c3abc to 2312ed3 Compare July 15, 2026 14:55

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2312ed3. Configure here.

const dsc = { ...getDynamicSamplingContextFromScope(client, capturedScope) };
if (isIgnoredRoot) {
dsc.sampled = 'false';
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignored child mistaken for root

Medium Severity

Streamed ignoreSpans placeholders are created without addChildSpanToSpan, so getRootSpan on an ignored child returns that placeholder, not the real segment. New isIgnoredRoot / spanIsIgnored(rootSpan) logic then treats ignored children like ignored segment roots and forces a negative sampling decision in baggage and propagation whenever trace data is resolved from the placeholder span.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2312ed3. Configure here.

(!!activeSpan && spanIsIgnored(span)) ||
span.spanContext().traceState?.get(SENTRY_TRACE_STATE_CHILD_IGNORED) === '1';

return isIgnoredChild ? activeContext : api.trace.setSpan(activeContext, span);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignored segment root stays remote

Medium Severity

getStoreWithActiveSpan treats every native ignored span with an active OTel span as an ignored child and keeps the current context. That also applies to ignored segment roots while the incoming remote parent is still active, so the ignored segment never becomes the propagation span and headers can keep the remote parent’s positive sampling instead of the negative decision required for ignored segments.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2312ed3. Configure here.

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