Commit 8400a7f
authored
fix(compose): Ensure SentryTraced spans respect ignore-by-origin requests (#6058)
Commit 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.
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).1 parent 0b2fa67 commit 8400a7f
3 files changed
Lines changed: 45 additions & 11 deletions
File tree
- sentry-compose/src
- androidMain/kotlin/io/sentry/compose
- androidUnitTest/kotlin/io/sentry/compose
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
Lines changed: 19 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
132 | 137 | | |
133 | 138 | | |
134 | 139 | | |
| |||
145 | 150 | | |
146 | 151 | | |
147 | 152 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
152 | 162 | | |
153 | 163 | | |
154 | 164 | | |
| |||
237 | 247 | | |
238 | 248 | | |
239 | 249 | | |
| 250 | + | |
240 | 251 | | |
241 | 252 | | |
242 | 253 | | |
| |||
246 | 257 | | |
247 | 258 | | |
248 | 259 | | |
249 | | - | |
250 | | - | |
251 | 260 | | |
252 | 261 | | |
253 | 262 | | |
| |||
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
131 | 151 | | |
132 | 152 | | |
133 | 153 | | |
| |||
381 | 401 | | |
382 | 402 | | |
383 | 403 | | |
384 | | - | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
385 | 408 | | |
386 | 409 | | |
387 | 410 | | |
388 | 411 | | |
389 | 412 | | |
390 | 413 | | |
| 414 | + | |
391 | 415 | | |
392 | 416 | | |
393 | 417 | | |
| |||
0 commit comments