ref: Introduce inline type check for whether a span is StreamedSpan by ericapisani · Pull Request #6180 · getsentry/sentry-python
…ed check The `isinstance(span, StreamedSpan) and not isinstance(span, NoOpStreamedSpan)` pattern was scattered across the codebase and easy to get wrong — forgetting the `NoOpStreamedSpan` guard is a recurring code review catch. Extract it into a single `_is_sampled_streamed_span()` helper in `traces.py` with a `TypeGuard[StreamedSpan]` return type for proper type narrowing, and replace all instances of the combined check in `scope.py`, `starlette.py`, and `fastapi.py`.
ericapisani
changed the title
ref: Introduce
ref: Introduce _is_sampled_streamed_span() helper to replace repeated check_is_streamed_span() helper to replace repeated check
ericapisani
changed the title
ref: Introduce
ref: Introduce inline type check for whether a span is StreamedSpan_is_streamed_span() helper to replace repeated check
ericapisani
deleted the
create-sampled-span-helper-0doa2
branch
This was referenced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters