Skip to content

Provide an option to customize GrpcChannelOptions #5083

Open
@En3Tho

Description

Feature Request

Is your feature request related to a problem?

Unable to use grpc exporter in BlazorWasm with current OpenTelemetry grpc exporter code. Currently GrpcChannel is created with default GrpcChannelOptions which default ot using SocketsHttpHandler and invoke load balancing code which ends up crashing.

Unhandled exception: 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)

Describe the solution you'd like:

I want to introduce a class

public class OpenTelemetryGrpcChannelOptions
{
    public GrpcChannelOptions { get; set; } = new()
}

And augment OtlpGrpcTraceExportClient to somehow consume these options which then will be passed to OtlpExporterOptionsExtensions.CreateChannel

What do you want to happen instead? What is the expected behavior?

I want to provide a custom HttpClient/HttpClientHandler so grpc exporter in wasm won't crash

Which alternative solutions or features have you considered?

Alternative solution would be using HttpProtobuf but it requires keeping track of special endpoint for wasm and it is less effective than grpc

Additional Context

Add any other context about the feature request here.

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions