fix(core): Preserve propagation across ignored spans#22277
Conversation
size-limit report 📦
|
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>
|
@BugBot review |
There was a problem hiding this comment.
✅ 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.
71c3abc to
2312ed3
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ 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'; | ||
| } |
There was a problem hiding this comment.
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)
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); |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 2312ed3. Configure here.


This PR preserves trace propagation for ignored spans in span streaming mode:
sentry-traceheader, which already emitted a negative sampling decisionnode:httpTurns out, the DSC changes are also a requirement for #22246, so I threw it on top of this PR.
ref #22262