Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions sentry_sdk/integrations/opentelemetry/span_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,6 @@ def on_start(self, otel_span, parent_context=None):
# type: (OTelSpan, Optional[context_api.Context]) -> None
client = get_client()

if not client.dsn:
return

try:
_ = Dsn(client.dsn)
except Exception:
return

if client.options["instrumenter"] != INSTRUMENTER.OTEL:
return

Expand Down
13 changes: 11 additions & 2 deletions tests/integrations/opentelemetry/test_span_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,16 @@ def test_update_span_with_otel_data_db_query():
)


def test_on_start_transaction():
@pytest.mark.parametrize(
["dsn"],
[
pytest.param(
"https://[email protected]/123456", id="with a DSN"
),
pytest.param(None, id="with no DSN"),
],
)
def test_on_start_transaction(dsn):
otel_span = MagicMock()
otel_span.name = "Sample OTel Span"
otel_span.start_time = time.time_ns()
Expand All @@ -306,7 +315,7 @@ def test_on_start_transaction():

fake_client = MagicMock()
fake_client.options = {"instrumenter": "otel"}
fake_client.dsn = "https://[email protected]/123456"
fake_client.dsn = dsn
sentry_sdk.get_global_scope().set_client(fake_client)

with mock.patch(
Expand Down
Loading