feat(span-first): Support before_send_span#6239
Merged
Merged
@sentry/warden / warden: find-bugs
completed
May 18, 2026 in 20m 12s
1 issue
find-bugs: Found 1 issue (1 medium)
Medium
`before_send_span` exceptions propagate to user code via `__exit__`, unlike `before_send` for events - `tests/tracing/test_span_streaming.py:273-280`
If a user's before_send_span callback raises, the exception propagates through StreamedSpan.__exit__, crashing the surrounding with block. The main before_send for events wraps the callback in capture_internal_exceptions(); _capture_telemetry in client.py does not — add a with capture_internal_exceptions(): guard there and add a test case here.
⏱ 19m 42s · 4.9M in / 169.7k out · $5.43
Annotations
Check warning on line 280 in tests/tracing/test_span_streaming.py
sentry-warden / warden: find-bugs
`before_send_span` exceptions propagate to user code via `__exit__`, unlike `before_send` for events
If a user's `before_send_span` callback raises, the exception propagates through `StreamedSpan.__exit__`, crashing the surrounding `with` block. The main `before_send` for events wraps the callback in `capture_internal_exceptions()`; `_capture_telemetry` in `client.py` does not — add a `with capture_internal_exceptions():` guard there and add a test case here.
Loading