feat(asgi): Migrate away from event processor in span first #5920
2 issues
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.
Low
capture_items fixture may raise KeyError if span has no attributes - `tests/conftest.py:352-354`
The capture_items fixture unconditionally accesses json["attributes"] (line 353), but _span_batcher._to_transport_format only includes the attributes key when item._attributes is truthy (line 116-119 in _span_batcher.py). While in practice StreamedSpan.end() always sets segment attributes, this creates a fragile dependency on implementation details. If a span somehow ends up without attributes (e.g., through mocking or future code changes), the fixture will raise a KeyError.
4 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| code-review | 1 | 4m 31s | $2.67 |
| find-bugs | 1 | 5m 31s | $5.49 |
| skill-scanner | 0 | 5m 42s | $0.46 |
| security-review | 0 | 6m 26s | $1.05 |
Duration: 22m 10s · Tokens: 6.7M in / 72.0k out · Cost: $9.69 (+extraction: $0.01, +fix_gate: $0.01, +dedup: $0.00)