Skip to content

Commit 24d4a6f

Browse files
committed
Add check for NoOpStreamedSpan
1 parent 8e7a6ab commit 24d4a6f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sentry_sdk/integrations/fastapi.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import sentry_sdk
66
from sentry_sdk.integrations import DidNotEnable
77
from sentry_sdk.scope import should_send_default_pii
8-
from sentry_sdk.traces import StreamedSpan
8+
from sentry_sdk.traces import NoOpStreamedSpan, StreamedSpan
99
from sentry_sdk.tracing import SOURCE_FOR_STYLE, TransactionSource
1010
from sentry_sdk.utils import transaction_from_function
1111

@@ -83,7 +83,9 @@ def _sentry_call(*args: "Any", **kwargs: "Any") -> "Any":
8383
current_scope = sentry_sdk.get_current_scope()
8484
current_span = current_scope.span
8585

86-
if isinstance(current_span, StreamedSpan):
86+
if isinstance(current_span, StreamedSpan) and not isinstance(
87+
current_span, NoOpStreamedSpan
88+
):
8789
segment = current_span._segment
8890
segment._update_active_thread()
8991
elif current_scope.transaction is not None:

0 commit comments

Comments
 (0)