Skip to content

feat(chalice): Add span streaming support to Chalice integration#6503

Merged
ericapisani merged 12 commits into
masterfrom
py-2312-migrate-chalice
Jun 12, 2026
Merged

feat(chalice): Add span streaming support to Chalice integration#6503
ericapisani merged 12 commits into
masterfrom
py-2312-migrate-chalice

Merge branch 'master' into py-2312-migrate-chalice

51cf45a
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: find-bugs completed Jun 11, 2026 in 13m 44s

1 issue

find-bugs: Found 1 issue (1 medium)

Medium

Missing transaction name on scope in streaming mode when no active segment span exists - `sentry_sdk/integrations/chalice.py:21`

In _get_view_function_response, when span streaming is enabled (has_span_streaming_enabled) but no StreamedSpan segment is active (e.g. the Chalice app runs without the AWS Lambda integration, which is the only thing that creates the segment), segment stays None and the streaming branch never calls scope.set_transaction_name(...). Errors are still captured via capture_event, but the resulting events carry no transaction context. The non-streaming else branch always sets scope.set_transaction_name(app.lambda_context.function_name, source=TransactionSource.COMPONENT), so for any setup without an active segment this is a behavioral regression where error/message events lose their transaction name.

Also found at:

  • tests/integrations/chalice/test_chalice.py:199-236

⏱ 12m 29s · 1.9M in / 92.6k out · $2.72

Annotations

Check warning on line 21 in sentry_sdk/integrations/chalice.py

See this annotation in the file changed.

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

Missing transaction name on scope in streaming mode when no active segment span exists

In `_get_view_function_response`, when span streaming is enabled (`has_span_streaming_enabled`) but no `StreamedSpan` segment is active (e.g. the Chalice app runs without the AWS Lambda integration, which is the only thing that creates the segment), `segment` stays `None` and the streaming branch never calls `scope.set_transaction_name(...)`. Errors are still captured via `capture_event`, but the resulting events carry no transaction context. The non-streaming `else` branch always sets `scope.set_transaction_name(app.lambda_context.function_name, source=TransactionSource.COMPONENT)`, so for any setup without an active segment this is a behavioral regression where error/message events lose their transaction name.

Check warning on line 236 in tests/integrations/chalice/test_chalice.py

See this annotation in the file changed.

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

[CR3-M9L] Missing transaction name on scope in streaming mode when no active segment span exists (additional location)

In `_get_view_function_response`, when span streaming is enabled (`has_span_streaming_enabled`) but no `StreamedSpan` segment is active (e.g. the Chalice app runs without the AWS Lambda integration, which is the only thing that creates the segment), `segment` stays `None` and the streaming branch never calls `scope.set_transaction_name(...)`. Errors are still captured via `capture_event`, but the resulting events carry no transaction context. The non-streaming `else` branch always sets `scope.set_transaction_name(app.lambda_context.function_name, source=TransactionSource.COMPONENT)`, so for any setup without an active segment this is a behavioral regression where error/message events lose their transaction name.