elastic / elastic-otel-dotnet

Elastic OpenTelemetry .NET Distribution

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ensure AddOtlpExporter can be called multiple times.

Mpdreamz opened this issue · comments

Right now we add it automatically when calling AddOpenTelemetry() as a cross cutting exporter using UseOtlpExporter().

If later signal specific calls add it using AddOtlpExporter they will get an exception.

Unhandled exception. System.NotSupportedException: Signal-specific AddOtlpExporter methods and the cross-cutting UseOtlpExporter method being invoked on the same IServiceCollect
ion is not supported.

Mpdreamz/opentelemetry-demo@b5ae9bf.

I personally think it be better if this was a NOOP if the AddOtlpExporter does not throw on repeated invocations if the configuration matches the already configured OTLP exporter.

We'll need to investigate if we think this is possible and a good idea and then propose this upstream.