From 63c4f15bcf264c3295e2cf3d40989768764cb014 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Wed, 20 May 2026 13:39:28 +0200 Subject: [PATCH 1/3] ref: Remove unused segment name setting --- sentry_sdk/integrations/wsgi.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/sentry_sdk/integrations/wsgi.py b/sentry_sdk/integrations/wsgi.py index af7b2ca1e2..5261c12ed4 100644 --- a/sentry_sdk/integrations/wsgi.py +++ b/sentry_sdk/integrations/wsgi.py @@ -174,24 +174,7 @@ def __call__( ) except BaseException: reraise(*_capture_exception()) - finally: - if isinstance(span, StreamedSpan): - already_set = ( - span.name != _DEFAULT_TRANSACTION_NAME - and span.get_attributes().get("sentry.span.source") - in [ - SegmentSource.COMPONENT.value, - SegmentSource.ROUTE.value, - SegmentSource.CUSTOM.value, - ] - ) - if not already_set: - with capture_internal_exceptions(): - span.name = _DEFAULT_TRANSACTION_NAME - span.set_attribute( - "sentry.span.source", - SegmentSource.ROUTE.value, - ) + finally: _wsgi_middleware_applied.set(False) From 4a34a8b3fae0b2ec34d0684544573d0a9a7d2274 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Wed, 20 May 2026 13:45:40 +0200 Subject: [PATCH 2/3] asgi too --- sentry_sdk/integrations/asgi.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/sentry_sdk/integrations/asgi.py b/sentry_sdk/integrations/asgi.py index e36ce4a435..c86cca82a3 100644 --- a/sentry_sdk/integrations/asgi.py +++ b/sentry_sdk/integrations/asgi.py @@ -367,27 +367,6 @@ async def _sentry_wrapped_send( self._capture_request_exception(exc) reraise(*exc_info) - finally: - if isinstance(span, StreamedSpan): - already_set = ( - span is not None - and span.name != _DEFAULT_TRANSACTION_NAME - and span.get_attributes().get("sentry.span.source") - in [ - SegmentSource.COMPONENT.value, - SegmentSource.ROUTE.value, - SegmentSource.CUSTOM.value, - ] - ) - with capture_internal_exceptions(): - if not already_set: - name, source = ( - self._get_segment_name_and_source( - self.transaction_style, scope - ) - ) - span.name = name - span.set_attribute("sentry.span.source", source) finally: _asgi_middleware_applied.set(False) From 9f460d60957789c648ad68a0cad3355718842f3b Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Wed, 20 May 2026 13:58:49 +0200 Subject: [PATCH 3/3] nah just wsgi --- sentry_sdk/integrations/asgi.py | 21 +++++++++++++++++++++ sentry_sdk/integrations/wsgi.py | 1 - 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/integrations/asgi.py b/sentry_sdk/integrations/asgi.py index c86cca82a3..e36ce4a435 100644 --- a/sentry_sdk/integrations/asgi.py +++ b/sentry_sdk/integrations/asgi.py @@ -367,6 +367,27 @@ async def _sentry_wrapped_send( self._capture_request_exception(exc) reraise(*exc_info) + finally: + if isinstance(span, StreamedSpan): + already_set = ( + span is not None + and span.name != _DEFAULT_TRANSACTION_NAME + and span.get_attributes().get("sentry.span.source") + in [ + SegmentSource.COMPONENT.value, + SegmentSource.ROUTE.value, + SegmentSource.CUSTOM.value, + ] + ) + with capture_internal_exceptions(): + if not already_set: + name, source = ( + self._get_segment_name_and_source( + self.transaction_style, scope + ) + ) + span.name = name + span.set_attribute("sentry.span.source", source) finally: _asgi_middleware_applied.set(False) diff --git a/sentry_sdk/integrations/wsgi.py b/sentry_sdk/integrations/wsgi.py index 5261c12ed4..32dcfd702b 100644 --- a/sentry_sdk/integrations/wsgi.py +++ b/sentry_sdk/integrations/wsgi.py @@ -174,7 +174,6 @@ def __call__( ) except BaseException: reraise(*_capture_exception()) - finally: _wsgi_middleware_applied.set(False)