From 54cda5253c3c21214ce0b9447900b94cacdae938 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Tue, 19 Nov 2024 14:47:00 +0100 Subject: [PATCH] preserve behavior --- sentry_sdk/integrations/wsgi.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sentry_sdk/integrations/wsgi.py b/sentry_sdk/integrations/wsgi.py index dfe3cc09f9..42700a0c02 100644 --- a/sentry_sdk/integrations/wsgi.py +++ b/sentry_sdk/integrations/wsgi.py @@ -119,11 +119,12 @@ def __call__(self, environ, start_response): origin=self.span_origin, ) - transaction = sentry_sdk.start_transaction( - transaction, - custom_sampling_context={"wsgi_environ": environ}, - ) - transaction.__enter__() + if transaction is not None: + transaction = sentry_sdk.start_transaction( + transaction, + custom_sampling_context={"wsgi_environ": environ}, + ) + transaction.__enter__() try: response = self.app(