Only enable OTLP exporter when configured

This wasn't a problem in the past, since we only enabled automatic
instrumentation when this was set up, but it does cause errors when
trying to add manual instrumentation.
This commit is contained in:
Wesley Aptekar-Cassels 2023-03-20 20:49:52 -04:00
parent e9d08e7424
commit ef64fedbd9

View file

@ -10,7 +10,7 @@ if settings.OTEL_EXPORTER_CONSOLE:
trace.get_tracer_provider().add_span_processor(
BatchSpanProcessor(ConsoleSpanExporter())
)
else:
elif settings.OTEL_EXPORTER_OTLP_ENDPOINT:
trace.get_tracer_provider().add_span_processor(
BatchSpanProcessor(OTLPSpanExporter())
)