|
5 | 5 | import sentry_sdk |
6 | 6 | from sentry_sdk.integrations import DidNotEnable |
7 | 7 | from sentry_sdk.scope import should_send_default_pii |
8 | | -from sentry_sdk.traces import NoOpStreamedSpan, StreamedSpan |
| 8 | +from sentry_sdk.traces import NoOpStreamedSpan |
9 | 9 | from sentry_sdk.tracing import SOURCE_FOR_STYLE, TransactionSource |
10 | 10 | from sentry_sdk.tracing_utils import has_span_streaming_enabled |
11 | 11 | from sentry_sdk.utils import transaction_from_function |
@@ -90,13 +90,15 @@ def _sentry_get_request_handler(*args: "Any", **kwargs: "Any") -> "Any": |
90 | 90 | @wraps(old_call) |
91 | 91 | def _sentry_call(*args: "Any", **kwargs: "Any") -> "Any": |
92 | 92 | current_scope = sentry_sdk.get_current_scope() |
93 | | - current_span = current_scope.span |
94 | 93 |
|
95 | | - if isinstance(current_span, StreamedSpan) and not isinstance( |
96 | | - current_span, NoOpStreamedSpan |
97 | | - ): |
98 | | - segment = current_span._segment |
99 | | - segment._update_active_thread() |
| 94 | + client = sentry_sdk.get_client() |
| 95 | + if has_span_streaming_enabled(client.options): |
| 96 | + current_span = current_scope.streamed_span |
| 97 | + |
| 98 | + if not isinstance(current_span, NoOpStreamedSpan): |
| 99 | + segment = current_span._segment |
| 100 | + segment._update_active_thread() |
| 101 | + |
100 | 102 | elif current_scope.transaction is not None: |
101 | 103 | current_scope.transaction.update_active_thread() |
102 | 104 |
|
|
0 commit comments