[do not merge] feat: Span streaming & new span API #5551
4 issues
find-bugs: Found 4 issues (1 high, 2 medium, 1 low)
High
StreamedSpan has no set_status method - will raise AttributeError at runtime - `sentry_sdk/integrations/sqlalchemy.py:102`
The code calls span.set_status(SpanStatus.ERROR) when span is a StreamedSpan, but StreamedSpan class does not have a set_status method. It only has a status property setter. When a SQL error occurs in streaming mode, this will raise an AttributeError: 'StreamedSpan' object has no attribute 'set_status', preventing proper error handling and potentially breaking the application.
Medium
Missing HTTP status code attribute for StreamedSpan in sync client - `sentry_sdk/integrations/httpx.py:117-119`
When span streaming is enabled, the StreamedSpan sets span.status and reason attribute but does NOT set the HTTP status code attribute (SPANDATA.HTTP_STATUS_CODE / http.response.status_code). The legacy Span.set_http_status() method sets this attribute at line 635 of sentry_sdk/tracing.py. This results in incomplete span telemetry data - users won't see the actual HTTP status code in their traces when using span streaming mode.
Also found at:
sentry_sdk/integrations/httpx.py:200-202sentry_sdk/integrations/stdlib.py:175-177
NameError when Redis command raises exception - `sentry_sdk/integrations/redis/_sync_common.py:158`
When old_execute_command raises an exception, the value variable is never assigned. The finally block then attempts to use value in _set_cache_data(cache_span, self, cache_properties, value), causing a NameError. While wrapped in capture_internal_exceptions(), this silently loses cache span metadata and may cause confusing internal error logs.
Also found at:
sentry_sdk/integrations/strawberry.py:226
Low
Inconsistent span name 'subprocess popen' for SUBPROCESS_WAIT operation - `sentry_sdk/integrations/stdlib.py:322-323`
In sentry_patched_popen_wait, the span name is set to 'subprocess popen' (line 322) while the operation is OP.SUBPROCESS_WAIT (line 323). This appears to be a copy-paste error. The other subprocess functions use consistent naming: 'subprocess communicate' with SUBPROCESS_COMMUNICATE. This inconsistency will cause confusion when analyzing traces since the span name doesn't match the actual operation being performed.
Duration: 20m 42s · Tokens: 11.9M in / 121.3k out · Cost: $18.95 (+extraction: $0.03, +merge: $0.00, +fix_gate: $0.01)
Annotations
Check failure on line 102 in sentry_sdk/integrations/sqlalchemy.py
sentry-warden / warden: find-bugs
StreamedSpan has no set_status method - will raise AttributeError at runtime
The code calls `span.set_status(SpanStatus.ERROR)` when `span` is a `StreamedSpan`, but `StreamedSpan` class does not have a `set_status` method. It only has a `status` property setter. When a SQL error occurs in streaming mode, this will raise an `AttributeError: 'StreamedSpan' object has no attribute 'set_status'`, preventing proper error handling and potentially breaking the application.
Check warning on line 119 in sentry_sdk/integrations/httpx.py
sentry-warden / warden: find-bugs
Missing HTTP status code attribute for StreamedSpan in sync client
When span streaming is enabled, the `StreamedSpan` sets `span.status` and `reason` attribute but does NOT set the HTTP status code attribute (`SPANDATA.HTTP_STATUS_CODE` / `http.response.status_code`). The legacy `Span.set_http_status()` method sets this attribute at line 635 of `sentry_sdk/tracing.py`. This results in incomplete span telemetry data - users won't see the actual HTTP status code in their traces when using span streaming mode.
Check warning on line 202 in sentry_sdk/integrations/httpx.py
sentry-warden / warden: find-bugs
[UB9-UW7] Missing HTTP status code attribute for StreamedSpan in sync client (additional location)
When span streaming is enabled, the `StreamedSpan` sets `span.status` and `reason` attribute but does NOT set the HTTP status code attribute (`SPANDATA.HTTP_STATUS_CODE` / `http.response.status_code`). The legacy `Span.set_http_status()` method sets this attribute at line 635 of `sentry_sdk/tracing.py`. This results in incomplete span telemetry data - users won't see the actual HTTP status code in their traces when using span streaming mode.
Check warning on line 177 in sentry_sdk/integrations/stdlib.py
sentry-warden / warden: find-bugs
[UB9-UW7] Missing HTTP status code attribute for StreamedSpan in sync client (additional location)
When span streaming is enabled, the `StreamedSpan` sets `span.status` and `reason` attribute but does NOT set the HTTP status code attribute (`SPANDATA.HTTP_STATUS_CODE` / `http.response.status_code`). The legacy `Span.set_http_status()` method sets this attribute at line 635 of `sentry_sdk/tracing.py`. This results in incomplete span telemetry data - users won't see the actual HTTP status code in their traces when using span streaming mode.
Check warning on line 158 in sentry_sdk/integrations/redis/_sync_common.py
sentry-warden / warden: find-bugs
NameError when Redis command raises exception
When `old_execute_command` raises an exception, the `value` variable is never assigned. The `finally` block then attempts to use `value` in `_set_cache_data(cache_span, self, cache_properties, value)`, causing a NameError. While wrapped in `capture_internal_exceptions()`, this silently loses cache span metadata and may cause confusing internal error logs.
Check warning on line 226 in sentry_sdk/integrations/strawberry.py
sentry-warden / warden: find-bugs
[DL9-5ZR] NameError when Redis command raises exception (additional location)
When `old_execute_command` raises an exception, the `value` variable is never assigned. The `finally` block then attempts to use `value` in `_set_cache_data(cache_span, self, cache_properties, value)`, causing a NameError. While wrapped in `capture_internal_exceptions()`, this silently loses cache span metadata and may cause confusing internal error logs.