feat(httpx): Migrate to span first #6084
2 issues
Medium
Missing 'reason' attribute in span streaming path causes data loss - `sentry_sdk/integrations/httpx.py:99-104`
The new span streaming code path (lines 99-109) does not include the HTTP reason phrase (rv.reason_phrase) in the span attributes. The legacy path at line 145 sets span.set_data("reason", rv.reason_phrase), but the streaming path only sets status and HTTP_STATUS_CODE. This means users migrating to span streaming will lose the reason phrase data from their HTTP client spans.
Low
Span streaming path doesn't capture HTTP reason phrase - `sentry_sdk/integrations/httpx.py:209-211`
In the async client's span streaming path, the reason attribute (HTTP reason phrase like 'OK', 'Not Found') is not being set on the segment attributes. The legacy path captures rv.reason_phrase via span.set_data("reason", rv.reason_phrase), but the span streaming path only sets SPANDATA.HTTP_STATUS_CODE. This creates an inconsistency where spans created via the new path have less information than the legacy path.
4 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| code-review | 1 | 3m 58s | $3.20 |
| find-bugs | 1 | 7m 40s | $7.96 |
| skill-scanner | 0 | 3m 43s | $1.27 |
| security-review | 0 | 4m 7s | $1.29 |
Duration: 19m 28s · Tokens: 8.5M in / 69.1k out · Cost: $13.73 (+extraction: $0.01, +fix_gate: $0.00, +dedup: $0.00)