Skip to content

Commit 618d6ca

Browse files
committed
Don't parse DSN twice
1 parent e7cbb59 commit 618d6ca

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

sentry_sdk/integrations/opentelemetry/span_processor.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,6 @@ def on_start(self, otel_span, parent_context=None):
119119
if not client.dsn:
120120
return
121121

122-
try:
123-
_ = Dsn(client.dsn)
124-
except Exception:
125-
return
126-
127122
if client.options["instrumenter"] != INSTRUMENTER.OTEL:
128123
return
129124

@@ -223,8 +218,12 @@ def _is_sentry_span(self, otel_span):
223218

224219
dsn_url = None
225220
client = get_client()
221+
226222
if client.dsn:
227-
dsn_url = Dsn(client.dsn).netloc
223+
try:
224+
dsn_url = Dsn(client.dsn).netloc
225+
except Exception:
226+
pass
228227

229228
if otel_span_url and dsn_url in otel_span_url:
230229
return True

0 commit comments

Comments
 (0)