diff --git a/sentry_sdk/integrations/flask.py b/sentry_sdk/integrations/flask.py index 4d85d83189..975b776f3e 100644 --- a/sentry_sdk/integrations/flask.py +++ b/sentry_sdk/integrations/flask.py @@ -156,7 +156,7 @@ def _request_started(app, **kwargs): def _request_finished(sender, response, **kwargs): - # Manually close the transaction because Bottle does not call `close()` on the WSGI response + # Manually close the transaction because Flask does not call `close()` on the WSGI response finish_running_transaction() diff --git a/sentry_sdk/tracing_utils.py b/sentry_sdk/tracing_utils.py index 8ea540a8a7..cd4e71528c 100644 --- a/sentry_sdk/tracing_utils.py +++ b/sentry_sdk/tracing_utils.py @@ -729,5 +729,7 @@ def get_current_span(scope=None): def finish_running_transaction(): # type: () -> None current_scope = sentry_sdk.get_current_scope() - if current_scope._transaction is not None and hasattr(current_scope._transaction, "_context_manager_state"): - current_scope._transaction.__exit__(None, None, None) + if current_scope.transaction is not None and hasattr( + current_scope.transaction, "_context_manager_state" + ): + current_scope.transaction.__exit__(None, None, None)