Skip to content

Commit de516ee

Browse files
committed
fix(wsgi): Use hub.trace
1 parent d710109 commit de516ee

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

sentry_sdk/integrations/wsgi.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,17 @@ def __call__(self, environ, start_response):
7878
hub = Hub(Hub.current)
7979

8080
with hub:
81-
span = None
8281
with capture_internal_exceptions():
8382
with hub.configure_scope() as scope:
8483
scope.clear_breadcrumbs()
8584
scope._name = "wsgi"
8685
scope.add_event_processor(_make_wsgi_event_processor(environ))
87-
scope.span = span = Span.continue_from_environ(environ)
8886

89-
try:
90-
rv = self.app(environ, start_response)
91-
except BaseException:
92-
reraise(*_capture_exception(hub))
93-
finally:
94-
if span is not None:
95-
span.finish()
96-
hub.finish_trace(span)
87+
with hub.trace(Span.continue_from_environ(environ)):
88+
try:
89+
rv = self.app(environ, start_response)
90+
except BaseException:
91+
reraise(*_capture_exception(hub))
9792

9893
return _ScopedResponse(hub, rv)
9994

0 commit comments

Comments
 (0)