Skip to content

.

811b05d
Select commit
Loading
Failed to load commit list.
Merged

fix: Introduce _get_current_streamed_span() to keep types backwards compatible #6177

.
811b05d
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: code-review completed Apr 30, 2026 in 1m 29s

1 issue

code-review: Found 1 issue (1 medium)

Medium

Transaction active-thread fallback skipped when span streaming is enabled but no streamed span exists - `sentry_sdk/integrations/starlette.py:557-565`

The refactor changes the structure to if span_streaming: ... elif current_scope.transaction is not None:. When span streaming is enabled but current_scope.streamed_span is not a usable StreamedSpan (e.g., it's None or a NoOpStreamedSpan), the inner branch is skipped and the elif is never evaluated, so current_scope.transaction.update_active_thread() is no longer called. Previously the equivalent fallback path executed whenever the streamed span check failed. As a result, profiling thread updates can be silently dropped for sync Starlette requests when streaming is enabled but no streamed span is active.


Duration: 1m 28s · Tokens: 302.1k in / 4.2k out · Cost: $1.57

Annotations

Check warning on line 565 in sentry_sdk/integrations/starlette.py

See this annotation in the file changed.

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

Transaction active-thread fallback skipped when span streaming is enabled but no streamed span exists

The refactor changes the structure to `if span_streaming: ... elif current_scope.transaction is not None:`. When span streaming is enabled but `current_scope.streamed_span` is not a usable `StreamedSpan` (e.g., it's `None` or a `NoOpStreamedSpan`), the inner branch is skipped and the `elif` is never evaluated, so `current_scope.transaction.update_active_thread()` is no longer called. Previously the equivalent fallback path executed whenever the streamed span check failed. As a result, profiling thread updates can be silently dropped for sync Starlette requests when streaming is enabled but no streamed span is active.