2

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.

5
  • I'd recommend trying a different exporter that doesn't rely on gRPC. The OTLP exporter will work over HTTP. Commented Aug 29, 2023 at 13:23
  • Changing it to HttpProtobuf and setting processor type to simple does not generate the exception...however, it seems like data still isn't being sent to jaeger...
    – Luis Abreu
    Commented Aug 29, 2023 at 14:04
  • Did you got solution for this ? I am also facing similar king of issue.
    – Prasad
    Commented Sep 22, 2023 at 12:19
  • Hello. Unfortunately, no.
    – Luis Abreu
    Commented Sep 25, 2023 at 10:30
  • Jaeger Exporter for OpenTelemetry .NET only uses UDP at the moment which does not work in Blazor / WebAssembly applications. Jaeger does however support the Zipkin protocol. So try using Zipkin instead. Commented Jun 26 at 12:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.