From c01d1f16a93f2621a3cda85a3998661c6776691d Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Fri, 12 Jun 2026 08:56:31 +0200 Subject: [PATCH] ref: Stop returning StreamedSpan from get_start_span_function() --- sentry_sdk/ai/utils.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sentry_sdk/ai/utils.py b/sentry_sdk/ai/utils.py index 1a353a6120..7b1ca9324b 100644 --- a/sentry_sdk/ai/utils.py +++ b/sentry_sdk/ai/utils.py @@ -13,7 +13,6 @@ import sentry_sdk from sentry_sdk.traces import StreamedSpan -from sentry_sdk.tracing_utils import has_span_streaming_enabled from sentry_sdk.utils import logger MAX_GEN_AI_MESSAGE_BYTES = 20_000 # 20KB @@ -538,13 +537,7 @@ def normalize_message_roles(messages: "list[dict[str, Any]]") -> "list[dict[str, def get_start_span_function() -> "Callable[..., Any]": - if has_span_streaming_enabled(sentry_sdk.get_client().options): - return sentry_sdk.traces.start_span - current_span = sentry_sdk.get_current_span() - if isinstance(current_span, StreamedSpan): - # mypy - return sentry_sdk.traces.start_span transaction_exists = ( current_span is not None and current_span.containing_transaction is not None