Skip to content

fixes

e2484bd
Select commit
Loading
Failed to load commit list.
Merged

feat(asgi): Make integration fully span first compatible #5920

fixes
e2484bd
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden completed Mar 30, 2026 in 4m 22s

4 issues

Medium

StreamedSpan name and source not updated on exception path - `sentry_sdk/integrations/asgi.py:349-357`

When the ASGI app raises an exception, the code to update the StreamedSpan name and source (lines 349-355) is skipped because it's only in the success path. This means error spans will have the generic initial transaction name instead of the resolved endpoint/URL name. The event processor handled this for traditional transactions, but the PR description states span-first mode has no event processors, leaving error spans with incomplete data.

AnnotatedValue objects stored as span attributes instead of valid AttributeValue types - `sentry_sdk/integrations/_asgi_common.py:124-125`

When should_send_default_pii() returns False, _filter_headers() returns sensitive header values as AnnotatedValue objects (see _wsgi_common.py:218-225). The new code at line 124-125 stores these directly into attributes without checking if they're AnnotatedValue instances. Since AnnotatedValue is not a valid AttributeValue type (which only accepts primitives and lists/tuples of primitives), this will cause type errors or unexpected serialization behavior when the attributes are processed downstream.

Low

None value may be stored as http.query attribute violating AttributeValue type - `sentry_sdk/integrations/_asgi_common.py:127`

_get_query() returns None when there is no query string (lines 64-66 in _get_query). The new code at line 127 unconditionally assigns this to attributes["http.query"], but None is not a valid AttributeValue type. This could cause serialization issues or type errors downstream when processing span attributes.

StreamedSpan name/source not updated when request raises exception - `sentry_sdk/integrations/asgi.py:349-357`

The new code at lines 349-355 that updates the segment name and source for StreamedSpans only executes on the success path after await self.app(...) returns. If the application raises an exception, the segment name update is skipped, and the span will be recorded with its initial generic name instead of the refined endpoint-based name. The existing event_processor (line 222-223) still processes error events for non-StreamedSpan flows, but StreamedSpans bypass this.

4 skills analyzed
Skill Findings Duration Cost
code-review 1 2m 40s $0.87
find-bugs 3 4m 8s $1.47
skill-scanner 0 1m 5s $0.41
security-review 0 2m 16s $0.86

Duration: 10m 9s · Tokens: 2.3M in / 27.4k out · Cost: $3.63 (+extraction: $0.01, +fix_gate: $0.01, +dedup: $0.00, +merge: $0.00)