fix(core): Do not activate ignored spans in the tracing-channel binding - #22981
Merged
Conversation
The AsyncLocalStorage tracing-channel binding planted every channel span as the active span, including ignored (`ignoreSpans`) placeholders. Because no span is emitted for an ignored span, its children and outgoing requests then propagated from it instead of the nearest emitted parent, dropping the continued sampling decision. Skip ignored spans so propagation falls back to that parent, matching the OpenTelemetry context manager. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
size-limit report 📦
|
An ignored root span must stay the active span so its whole subtree is dropped with it; only ignored children should be skipped (so their siblings/parent stay the propagation source). Match core startSpan and the OTel context manager with `getRootSpan(span) === span`, and cover both the ignored-child and ignored-root cases.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7475bcb. Configure here.
The ignored-child test started from an empty scope and only checked the active span was unset, which does not distinguish "parent dropped" from "parent preserved". Seed the parent as the active span and assert it remains active, covering the actual regression: nested spans and outgoing requests must keep propagating from the parent.
…r path Explain why an ignored child keeps its parent active (avoids orphaned/misparented downstream spans) while an ignored root stays active (drops its subtree), and note this mirrors the OpenTelemetry `getStoreWithActiveSpan` check so ignoreSpans behaves the same with or without a Sentry tracer provider.
Keep the code comment to the essential rule and move the longer justification and tracer-provider comparison to the PR description.
andreiborza
marked this pull request as ready for review
August 4, 2026 12:49
Lms24
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
In the AsyncLocalStorage tracing-channel binding, do not set an ignored (
ignoreSpans) child span as the active span.spanIsIgnoredguard in_INTERNAL_createTracingChannelBinding.Why
An ignored span emits nothing, so activating it broke propagation two ways. An ignored child left active makes its descendants parent to a span that never reaches Sentry, producing orphaned spans; keeping the parent active re-parents them onto the nearest emitted span. An ignored root must stay active so its whole subtree is dropped, otherwise its children escape as standalone spans. This applies the same
spanIsIgnored(span) && getRootSpan(span) !== spancheck the OpenTelemetry context manager uses, soignoreSpansbehaves the same with or without a tracer provider.sentry-javascript/packages/opentelemetry/src/asyncContextStrategy.ts
Lines 163 to 167 in 95e4e00