[otlp] UseOtlpExporter and AddOtlpExporter extensions don't play nice together #5538
Labels
pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol
Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package
In 1.8.0 we introduced the
UseOtlpExporter
extension which will turn onOtlpExporter
for all signals. IfUseOtlpExporter
is called more than once, orAddOtlpExporter
is called in addition, exceptions will be thrown:NotSupportedException: Multiple calls to UseOtlpExporter on the same IServiceCollection are not supported.
opentelemetry-dotnet/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Builder/OpenTelemetryBuilderServiceProviderExtensions.cs
Line 15 in 57c442c
NotSupportedException: Signal-specific AddOtlpExporter methods and the cross-cutting UseOtlpExporter method being invoked on the same IServiceCollection is not supported.
opentelemetry-dotnet/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Builder/OpenTelemetryBuilderServiceProviderExtensions.cs
Line 24 in 57c442c
This was intentionally done but some users have run into issues:
AddProcessor
instead ofAddOtlpExporter
dotnet/aspire#3697 (comment)Opening this issue to track the demand for changing the behavior.
The text was updated successfully, but these errors were encountered: