8000
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 971642b commit 04b3ce8Copy full SHA for 04b3ce8
sentry_sdk/tracing.py
@@ -1277,10 +1277,19 @@ def __enter__(self):
1277
# set as the implicit current context
1278
self._ctx_token = context.attach(ctx)
1279
1280
+ self._scope_manager = sentry_sdk.new_scope()
1281
+ scope = self._scope_manager.__enter__()
1282
+ scope.span = self
1283
+
1284
return self
1285
1286
def __exit__(self, ty, value, tb):
1287
# type: (Optional[Any], Optional[Any], Optional[Any]) -> None
1288
+ self._scope_manager.__exit__(ty, value, tb)
1289
+ del (
1290
+ self._scope_manager
1291
+ ) # Eliminate circular reference which could prevent garbage collection
1292
1293
self._otel_span.end()
1294
# XXX set status to error if unset and an exception occurred?
1295
if self._active:
0 commit comments