-
Notifications
You must be signed in to change notification settings - Fork 858
Description
Feature Request
Is your feature request related to a problem?
When I try to export data using OTLP exporter from behind a proxy, I get this exception:
Grpc.Core.RpcException: Status(StatusCode="Internal", Detail="Error starting gRPC call. HttpRequestException: Unable to get subchannel from HttpRequestMessage. (proxy detail) InvalidOperationException: Unable to get subchannel from HttpRequestMessage.", DebugException="System.Net.Http.HttpRequestException: Unable to get subchannel from HttpRequestMessage. (proxy detail)")
---> System.Net.Http.HttpRequestException: Unable to get subchannel from HttpRequestMessage. (proxy detail)
---> System.InvalidOperationException: Unable to get subchannel from HttpRequestMessage.
at Grpc.Net.Client.Balancer.Internal.BalancerHttpHandler.OnConnect(SocketsHttpConnectionContext context, CancellationToken cancellationToken) in C:\Users\ab027ps\source\repos\grpc-dotnet\src\Grpc.Net.Client\Balancer\Internal\BalancerHttpHandler.cs:line 89
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
Describe the solution you'd like:
This can be fixed by substituting the line 46 in this file https://github.com/open-telemetry/opentelemetry-dotnet/blob/031ed48714e16ba4a5b099b6e14647994a0b9c1b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptionsExtensions.cs
for
return GrpcChannel.ForAddress(options.Endpoint, new GrpcChannelOptions { HttpHandler = new HttpClientHandler() });
One possible solution would be to keep the current behavior as default but give users the ability to specify GrpcChannelOptions.
Describe alternatives you've considered.
Alternatively, there could be a boolean IsBehindAProxy property in OtlpExporterOptions which would switch between the current code and the line I posted above, although I don't know enough about gRPC to know if this would work generally.