feat(asgi): Make integration fully span first compatible #5920
@sentry/warden / warden: code-review
completed
Apr 2, 2026 in 4m 33s
1 issue
code-review: Found 1 issue (1 medium)
Medium
KeyError when span has no attributes - `tests/conftest.py:353`
The capture_items fixture assumes all metrics, logs, and spans have an attributes key, but spans may not have this key. In _span_batcher.py, the attributes key is only added conditionally when item._attributes is truthy. When a span without attributes is captured, accessing json["attributes"].items() will raise a KeyError.
Duration: 4m 31s · Tokens: 2.1M in / 26.6k out · Cost: $2.67 (+extraction: $0.00, +fix_gate: $0.00)
Annotations
Check warning on line 353 in tests/conftest.py
sentry-warden / warden: code-review
KeyError when span has no attributes
The `capture_items` fixture assumes all metrics, logs, and spans have an `attributes` key, but spans may not have this key. In `_span_batcher.py`, the `attributes` key is only added conditionally when `item._attributes` is truthy. When a span without attributes is captured, accessing `json["attributes"].items()` will raise a `KeyError`.
Loading