I'm adding distributed tracing to an existing app and I'm having a hard time configuring the client Blazor Wasm App to export its tracing through the OltpTraceExporter
. Here's the exception I'm getting at runtime:
System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.)
---> System.NullReferenceException: Object reference not set to an instance of an object.
at Grpc.Net.Client.Balancer.Internal.BalancerHttpHandler.IsSocketsHttpHandlerSetup(SocketsHttpHandler socketsHttpHandler)
at Grpc.Net.Client.Balancer.Internal.BalancerHttpHandler.ConfigureSocketsHttpHandlerSetup(SocketsHttpHandler socketsHttpHandler, Func`3 connectCallback)
at Grpc.Net.Client.GrpcChannel.CreateInternalHttpInvoker(HttpMessageHandler handler)
at Grpc.Net.Client.GrpcChannel..ctor(Uri address, GrpcChannelOptions channelOptions)
at Grpc.Net.Client.GrpcChannel.ForAddress(Uri address, GrpcChannelOptions channelOptions)
at Grpc.Net.Client.GrpcChannel.ForAddress(Uri address)
at OpenTelemetry.Exporter.OtlpExporterOptionsExtensions.CreateChannel(OtlpExporterOptions options)
at OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClient.OtlpGrpcTraceExportClient..ctor(OtlpExporterOptions options, TraceServiceClient traceServiceClient)
at OpenTelemetry.Exporter.OtlpExporterOptionsExtensions.GetTraceExportClient(OtlpExporterOptions options)
at OpenTelemetry.Exporter.OtlpTraceExporter..ctor(OtlpExporterOptions exporterOptions, SdkLimitOptions sdkLimitOptions, IExportClient`1 exportClient)
at OpenTelemetry.Trace.OtlpTraceExporterHelperExtensions.BuildOtlpExporterProcessor(OtlpExporterOptions exporterOptions, SdkLimitOptions sdkLimitOptions, IServiceProvider serviceProvider, Func`2 configureExporterInstance)
at OpenTelemetry.Trace.OtlpTraceExporterHelperExtensions.<>c__DisplayClass2_0.<AddOtlpExporter>b__1(IServiceProvider sp)
at OpenTelemetry.Trace.TracerProviderBuilderExtensions.<>c__DisplayClass8_0.<AddProcessor>b__0(IServiceProvider sp, TracerProviderBuilder builder)
at OpenTelemetry.Trace.OpenTelemetryDependencyInjectionTracingServiceCollectionExtensions.ConfigureTracerProviderBuilderCallbackWrapper.ConfigureBuilder(IServiceProvider serviceProvider, TracerProviderBuilder tracerProviderBuilder)
at OpenTelemetry.Trace.TracerProviderSdk..ctor(IServiceProvider serviceProvider, Boolean ownsServiceProvider)
at OpenTelemetry.Trace.TracerProviderBuilderBase.Build()
at OpenTelemetry.Trace.TracerProviderBuilderBase.InvokeBuild()
at OpenTelemetry.Trace.TracerProviderBuilderExtensions.Build(TracerProviderBuilder tracerProviderBuilder)
at Program.<Main>$(String[] args) in D:\code\work\tfsonline\AssistenciasHelpdesk\Grm.Assistencias.Web\Program.cs:line 95
And here's my telemetry configuration code on the Blazor wasm app:
ResourceBuilder resourceBuilder = ResourceBuilder.CreateDefault( ).AddService("DemoApp");
string jaegerEnpoint = builder.Configuration.GetValue<string>("jaegerUrl");
TracerProvider traceProvider = Sdk.CreateTracerProviderBuilder( )
.SetResourceBuilder(resourceBuilder)
.AddSource(AssistenciasClienteActivitySource.Instance.Name,
AssistenciasServicosActivitySource.Instance.Name)
.AddHttpClientInstrumentation()
.AddOtlpExporter(options => {
options.Protocol = OtlpExportProtocol.Grpc;
options.Endpoint = new Uri(jaegerEnpoint);
})
.Build( );
Am I missing something? Can anyone help?
Thanks.