Skip to content

Commit 2b30add

Browse files
fix(httpx): Consistently early-exit when adding request source (#6151)
Preserve the early-exit behavior when the client is inactive for both trace lifecycles. Follow-up on 409a779.
1 parent bd50a8e commit 2b30add

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

sentry_sdk/tracing_utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,10 @@ def add_http_request_source(
353353
Adds OTel compatible source code information to a span for an outgoing HTTP request
354354
"""
355355
client = sentry_sdk.get_client()
356+
if not client.is_active():
357+
return
356358

357359
if isinstance(span, LegacySpan):
358-
if not client.is_active():
359-
return
360-
361360
# In the StreamedSpan case, we need to add the extra span information before
362361
# the span finishes, so it's expected that this will be None. In the LegacySpan case,
363362
# it should already be finished.

0 commit comments

Comments
 (0)