Skip to content

feat(stdlib): Support span streaming

a3f7747
Select commit
Loading
Failed to load commit list.
Merged

feat(stdlib): Support span streaming #6154

feat(stdlib): Support span streaming
a3f7747
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: code-review completed Apr 28, 2026 in 46s

3 issues

code-review: Found 3 issues (1 high, 1 medium, 1 low)

High

Test accesses dict span via attribute syntax, causing AttributeError - `tests/integrations/stdlib/test_httplib.py:245`

After the refactor, request_span is taken from event["spans"][-1], which is a dict (serialized span from the captured event), not a Span object. Accessing request_span.span_id on a dict will raise AttributeError: 'dict' object has no attribute 'span_id', causing the test to fail at runtime. The code should use request_span["span_id"] instead.

Also found at:

  • tests/integrations/stdlib/test_httplib.py:289

Medium

Stray debug print statement left in production code - `sentry_sdk/integrations/stdlib.py:162`

A print("span is here") statement was added to the getresponse wrapper. This is clearly leftover debug output that will execute on every HTTP response handled by the stdlib integration, polluting stdout for all users of the SDK and potentially leaking into production logs. This is a behavioral side effect that affects every consumer of the integration.

Low

Identical branches in span_streaming if/else create dead code - `sentry_sdk/integrations/stdlib.py:260-271`

The if span_streaming and else branches at lines 260-271 invoke sentry_sdk.start_span with identical arguments, producing the same result regardless of the span_streaming flag. The span_streaming check therefore has no effect on behavior, suggesting either a missed code path (e.g., a different streaming-specific call was intended) or unnecessary branching. This may indicate incomplete implementation of span streaming support for the subprocess integration.


Duration: 43.9s · Tokens: 126.9k in / 3.0k out · Cost: $0.66 (+merge: $0.00)

Annotations

Check failure on line 245 in tests/integrations/stdlib/test_httplib.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: code-review

Test accesses dict span via attribute syntax, causing AttributeError

After the refactor, `request_span` is taken from `event["spans"][-1]`, which is a dict (serialized span from the captured event), not a Span object. Accessing `request_span.span_id` on a dict will raise `AttributeError: 'dict' object has no attribute 'span_id'`, causing the test to fail at runtime. The code should use `request_span["span_id"]` instead.

Check failure on line 289 in tests/integrations/stdlib/test_httplib.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: code-review

[LJX-ZXL] Test accesses dict span via attribute syntax, causing AttributeError (additional location)

After the refactor, `request_span` is taken from `event["spans"][-1]`, which is a dict (serialized span from the captured event), not a Span object. Accessing `request_span.span_id` on a dict will raise `AttributeError: 'dict' object has no attribute 'span_id'`, causing the test to fail at runtime. The code should use `request_span["span_id"]` instead.

Check warning on line 162 in sentry_sdk/integrations/stdlib.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: code-review

Stray debug print statement left in production code

A `print("span is here")` statement was added to the `getresponse` wrapper. This is clearly leftover debug output that will execute on every HTTP response handled by the stdlib integration, polluting stdout for all users of the SDK and potentially leaking into production logs. This is a behavioral side effect that affects every consumer of the integration.