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 completed Apr 21, 2026 in 2m 27s

1 issue

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.

4 skills analyzed
Skill Findings Duration Cost
code-review 0 2m 24s $0.83
find-bugs 1 1m 45s $1.14
skill-scanner 0 29.0s $0.33
security-review 0 49.9s $0.31

Duration: 5m 28s · Tokens: 1.5M in / 20.4k out · Cost: $2.60 (+extraction: $0.00)