fix(compose): Honor ignored origins for SentryTraced spans - #6058
Open
0xadam-brown wants to merge 1 commit into
Open
fix(compose): Honor ignored origins for SentryTraced spans#60580xadam-brown wants to merge 1 commit into
0xadam-brown wants to merge 1 commit into
Conversation
0xadam-brown
force-pushed
the
fix/sentry-traced-origin-filtering-bug
branch
from
September 5, 2026 13:35
3db1e97 to
a8aeb7e
Compare
Fix a bug where we set span origins for SentryTraced after their creation via the span context, resulting in our ignore-span-origins logic not being able to see them and spans being produced when they should have been ignored / suppressed.
What was happening?
SentryTracer checks `ignoredSpanOrigins` during span creation, before the returned span can be mutated:
```java
if (SpanUtils.isIgnored(scopes.getOptions().getIgnoredSpanOrigins(), spanOptions.getOrigin())) {
return NoOpSpan.getInstance();
}
```
That check reads SpanOptions.origin, not the SpanContext.origin we were setting after creation.
So if a host app did this...
```kotlin
options.setIgnoredSpanOrigins(listOf("auto.ui.jetpack_compose"))
```
...it would no-op and the Compose spans were created nonetheless.
The issue affected both levels of the SentryTraced span hierarchy (ie, both parent spans and child spans).
0xadam-brown
force-pushed
the
fix/sentry-traced-origin-filtering-bug
branch
from
September 5, 2026 13:36
a8aeb7e to
7b13e55
Compare
0xadam-brown
commented
Sep 5, 2026
| OP_COMPOSITION_CHILD, | ||
| tag, | ||
| startTimestamp, | ||
| Instrumenter.SENTRY, |
Member
Author
There was a problem hiding this comment.
Note: We have to specify the instrumenter explicitly b/c the only startChild() method that permits setting both the start timestamp and SentryOptions requires it. (This doesn't change behavior, as SentryTraced has always started children via Instrumenter.SENTRY under the hood.)
0xadam-brown
marked this pull request as ready for review
September 5, 2026 13:39
0xadam-brown
requested review from
adinauer,
markushi,
romtsn and
runningcode
as code owners
September 5, 2026 13:39
📲 Install BuildsAndroid
|
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.
📜 Description
Fixes a bug where we set span origins for SentryTraced after their creation via the span context, resulting in our ignore-span-origins logic not being able to see them and spans being produced when they should have been ignored / suppressed.
💡 Motivation and Context
This issue has been with us for a while, but was discovered (along with a number of others) in connection with my Nav3 work.
The general rule is that we need to set span origins during creation and not afterwards via span context or else checks list
ignoreSpanOriginswill be ignored.What went wrong?
SentryTracer checks
ignoredSpanOriginsduring span creation, before the returned span can be mutated:That check reads SpanOptions.origin, not the SpanContext.origin we were setting after creation.
So if a host app did this...
...it would no-op and the Compose spans were created nonetheless.
The issue affected both levels of the SentryTraced span hierarchy (ie, both parent spans and child spans).
💚 How did you test it?
Unit regression test + I had my clanker verify the fix works and is correct via our Android sample apps.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps