open-telemetry / opentelemetry-dotnet-instrumentation

OpenTelemetry .NET Automatic Instrumentation

Home Page:https://opentelemetry.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gRPC loading issue on .NET Framework 4.8

Kielek opened this issue · comments

Same issue on .NET Framework 4.8

Installed OTel packages:
OpenTelemetry V1.6.0
OpenTelemetry.Api V1.6.0
OpenTelemetry.Api.ProviderBuilderExtensions V1.6.0
OpenTelemetry.Exporter.Console V1.6.0
OpenTelemetry.Exporter.OpenTelemetryProtocol_V1.6.0_
OpenTelemetry.Extensions.Hosting V1.6.0
OpenTelemetry.Instrumentation.AspNet V1.6.0-beta.1
OpenTelemetry.Instrumentation.AspNet.TelemetryHtppModule V1.6.0-beta.1
OpenTelemetry.Instrumentation.Http V1.5.1-beta.1
OpenTelemetry.Instrumentation.SqlClient V1.5.1-beta.1

My GRPC packages are:
Grpc.Core.Api V2.46.6
Grpc V2.46.6
Grpc.Core V2.46.6

System.IO.FileNotFoundException: Error loading native library. Not found in any of the possible locations: C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Grpc.Core\v4.0_2.0.0.0__d754f35622e28bad\grpc_csharp_ext.x64.dll,C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Grpc.Core\v4.0_2.0.0.0__d754f35622e28bad\runtimes/win-x64/native\grpc_csharp_ext.x64.dll,C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Grpc.Core\v4.0_2.0.0.0__d754f35622e28bad\../..\runtimes/win-x64/native\grpc_csharp_ext.x64.dll
   at Grpc.Core.Internal.UnmanagedLibrary.FirstValidLibraryPath(String[] libraryPathAlternatives)
   at Grpc.Core.Internal.UnmanagedLibrary..ctor(String[] libraryPathAlternatives)
   at Grpc.Core.Internal.NativeExtension.LoadNativeMethodsUsingExplicitLoad()
   at Grpc.Core.Internal.NativeExtension.LoadNativeMethods()
   at Grpc.Core.Internal.NativeExtension..ctor()
   at Grpc.Core.Internal.NativeExtension.Get()
   at Grpc.Core.Internal.NativeMethods.Get()
   at Grpc.Core.GrpcEnvironment.GrpcNativeInit()
   at Grpc.Core.GrpcEnvironment..ctor()
   at Grpc.Core.GrpcEnvironment.AddRef()
   at Grpc.Core.Channel..ctor(String target, ChannelCredentials credentials, IEnumerable`1 options)
   at Grpc.Core.Channel..ctor(String target, ChannelCredentials credentials)
   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)

That workaround mentioned here does not work for me unfortunately.

Originally posted by @ClumsyPenguin in #1858 (comment)

@ClumsyPenguin, please track you issue separately.

Could you please be more descriptive with the issue?
What you are trying to achievie? If you really using automatic instrumentation or you are trying to establish it manually? https://github.com/open-telemetry/opentelemetry-dotnet

Minimal, Reproducible example will be helpgull

I am using manual instrumentation through an interceptor in our common interfaces for Services, Repositories, Controllers, etc...

Previously i was using Jaeger exporter to view my traces in Jaeger UI. However since that package is deprecated i am trying to switch to the OTLP exporter at this moment.

The solution works, however when i switch to this new exporter it will crash with the above stacktrace.

I will try and provide an MVP later today.

@Kielek https://github.com/ClumsyPenguin/OtelExporter

This is a MVP i quickly puzzled together which reproduced the issue.

image

@ClumsyPenguin, I do not think that your issues fits to this project. You are using fully manual instrumentation.
I would recommend to create issue under https://github.com/open-telemetry/opentelemetry-dotnet. You should find there better assistance.

@Kielek I made a bug report on that repo, you can close this one.