-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Grpc.Net.Client
with netstandard2.0
for OpenTelemetry.Exporter.OpenTelemetryProtocol
#3421
Comments
Looks like we already use the Grpc.Net.Client for netstandard2.1_or_higher. The package did not originally support netstandard2.0.. @alanwest explored this, in the context of Grpc instrumentation as well. |
Agreed we should solve this. Apart from the old gRPC library coping unnecessary native libs all over the place, it's also on the path to deprecation https://grpc.io/blog/grpc-csharp-future/.
Yes, I added the netstandard2.0 target to the gRPC instrumentation with minimal test coverage - that is, the test coverage does not make end-to-end calls to a real gRPC service. I think this coverage was adequate in the context of the instrumentation since it is the end user's responsibility to manage the gRPC channel and make it work with respect to the configuration required for older frameworks/environments as noted here https://docs.microsoft.com/aspnet/core/grpc/netstandard#net-implementations. Currently, our OTLP exporter's configuration does not allow the end user to fully manage the channel, so without having dug into things too deeply, I think there are three paths we could explore:
Given that there are already some other use cases that may be satisfied by option 3, I'd be inclined to explore this first. |
Someone was asking about channel customization on Slack today so I messed with option 3 a bit. Seems like it could work: public static GrpcChannel CreateChannel(this OtlpExporterOptions options)
{
if (options.Endpoint.Scheme != Uri.UriSchemeHttp && options.Endpoint.Scheme != Uri.UriSchemeHttps)
{
throw new NotSupportedException($"Endpoint URI scheme ({options.Endpoint.Scheme}) is not supported. Currently only \"http\" and \"https\" are supported.");
}
return GrpcChannel.ForAddress(
options.Endpoint,
new GrpcChannelOptions
{
HttpClient = options.HttpClientFactory?.Invoke() ?? throw new InvalidOperationException("OtlpExporterOptions was missing HttpClientFactory or it returned null."),
DisposeHttpClient = true,
});
} Just documenting here what I tried. Leaving it up to @alanwest (our gRPC expert) what we should do here 😄 |
I've chatted with @alanwest, and we are currently thinking to split the existing OTLP package into 2:
Please refer to the comment for more details: |
This issue was marked stale due to lack of activity and will be closed in 7 days. Commenting will instruct the bot to automatically remove the label. This bot runs once per day. |
Closed as inactive. Feel free to reopen if this issue is still a concern. |
Feature Request
Is your feature request related to a problem?
The old
Grpc
package copieslibgrpc_csharp_ext.x64.dylib
andlibgrpc_csharp_ext.x86.so
all over the place. That's ~17MB of unnecessary libs being copied to all of our the services that referencesOpenTelemetry.Exporter.OpenTelemetryProtocol
in our solution.Describe the solution you'd like:
It should be possible to use
Grpc.Net.Client
withnetstandard2.0
instead. In fact, in theory, anynet462
or greater app should be able to referencenetstandard2.0
.The text was updated successfully, but these errors were encountered: