Skip to content

feat(fastapi): Support span streaming in active thread tracking

8e7a6ab
Select commit
Loading
Failed to load commit list.
Merged

feat(fastapi): Support span streaming in active thread tracking #6118

feat(fastapi): Support span streaming in active thread tracking
8e7a6ab
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: find-bugs completed Apr 21, 2026 in 1m 46s

1 issue

find-bugs: Found 1 issue (1 high)

High

AttributeError when current_span is NoOpStreamedSpan due to missing _segment attribute - `sentry_sdk/integrations/fastapi.py:86-88`

The code checks isinstance(current_span, StreamedSpan) but NoOpStreamedSpan is a subclass of StreamedSpan that does NOT initialize the _segment attribute in its __init__. When traces_sample_rate < 1.0 or spans are ignored, the current span can be a NoOpStreamedSpan, and accessing current_span._segment will raise an AttributeError. Other code in the codebase uses the pattern isinstance(span, StreamedSpan) and not isinstance(span, NoOpStreamedSpan) to handle this.


Duration: 1m 45s · Tokens: 709.6k in / 7.6k out · Cost: $1.14 (+extraction: $0.00)

Annotations

Check failure on line 88 in sentry_sdk/integrations/fastapi.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: find-bugs

AttributeError when current_span is NoOpStreamedSpan due to missing _segment attribute

The code checks `isinstance(current_span, StreamedSpan)` but `NoOpStreamedSpan` is a subclass of `StreamedSpan` that does NOT initialize the `_segment` attribute in its `__init__`. When `traces_sample_rate < 1.0` or spans are ignored, the current span can be a `NoOpStreamedSpan`, and accessing `current_span._segment` will raise an `AttributeError`. Other code in the codebase uses the pattern `isinstance(span, StreamedSpan) and not isinstance(span, NoOpStreamedSpan)` to handle this.