We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cb37a07 commit ad6e7ccCopy full SHA for ad6e7cc
sentry_sdk/traces.py
@@ -319,10 +319,6 @@ def _end(self) -> None:
319
del self._previous_span_on_scope
320
self._scope.span = old_span
321
322
- client = sentry_sdk.get_client()
323
- if not client.is_active():
324
- return
325
-
326
# Set attributes from the segment
327
self.set_attribute("sentry.segment.id", self._segment.span_id)
328
self.set_attribute("sentry.segment.name", self._segment.name)
@@ -339,6 +335,10 @@ def _end(self) -> None:
339
335
340
336
self._finished = True
341
337
338
+ client = sentry_sdk.get_client()
+ if not client.is_active():
+ return
+
342
# Finally, queue the span for sending to Sentry
343
self._scope._capture_span(self)
344
0 commit comments