sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

Allow OTEL instrumenter to work even with no DSN.

Open jwhitaker-gridcog opened this issue 11 months ago • 0 comments

Allow OTEL instrumenter to work even with no DSN.

Context: we are writing tests for our Sentry integration itself, setting up a client like

events = []
c = sentry_sdk.Client(dsn=None, instrumenter='otel', transport=events.append)

, and verifying that events contains spans from OpenTelemetry such as

with tracer.start_as_current_span('fn'):
   raise Exception('boo')

assert events = [...]

This currently doesn't work because the Sentry OTEL integration has some hacks poking into the client and hard-returning if DSN is None.

I conjecture the hard-return can be removed - the check-DSN-to-avoid-sentry-otel-loops logic still works even without the DSN check in on_start().

jwhitaker-gridcog avatar Dec 31 '24 00:12 jwhitaker-gridcog