We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4668c3e commit 2064e0cCopy full SHA for 2064e0c
sentry_sdk/tracing.py
@@ -1283,10 +1283,19 @@ def __enter__(self):
1283
# set as the implicit current context
1284
self._ctx_token = context.attach(ctx)
1285
1286
+ self._scope_manager = sentry_sdk.new_scope()
1287
+ scope = self._scope_manager.__enter__()
1288
+ scope.span = self
1289
+
1290
return self
1291
1292
def __exit__(self, ty, value, tb):
1293
# type: (Optional[Any], Optional[Any], Optional[Any]) -> None
1294
+ self._scope_manager.__exit__(ty, value, tb)
1295
+ del (
1296
+ self._scope_manager
1297
+ ) # Eliminate circular reference which could prevent garbage collection
1298
1299
self._otel_span.end()
1300
# XXX set status to error if unset and an exception occurred?
1301
if self._active:
0 commit comments