From 032ea5723f6b637e919efc4c0f97373466ef3428 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 20 Jan 2023 10:06:28 +0100 Subject: [PATCH] Make sure to noop when there is no DSN (#1852) * Make sure to noop when there is no or invalid DSN --- sentry_sdk/integrations/opentelemetry/span_processor.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sentry_sdk/integrations/opentelemetry/span_processor.py b/sentry_sdk/integrations/opentelemetry/span_processor.py index 0dc7caaf2d..0017708a97 100644 --- a/sentry_sdk/integrations/opentelemetry/span_processor.py +++ b/sentry_sdk/integrations/opentelemetry/span_processor.py @@ -98,6 +98,14 @@ def on_start(self, otel_span, parent_context=None): if not hub: return + if not hub.client or (hub.client and not hub.client.dsn): + return + + try: + _ = Dsn(hub.client.dsn or "") + except Exception: + return + if hub.client and hub.client.options["instrumenter"] != INSTRUMENTER.OTEL: return