Skip to content
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

[WIP] Use OTLP exporter by default #324

Closed
wants to merge 2 commits into from

Conversation

pellared
Copy link
Member

@pellared pellared commented Jan 19, 2022

Fixes #325

Changes proposed in this pull request:

  • Use OTLP exporter by default.

Issues

  1. On .NET Core for some reason the spans from the OTLP exporter do not reach the Collector. Possibly caused by bad configuration.

  2. OTLP Exporter vs .NET Framework:

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'OpenTelemetry.ClrProfiler.Managed.Loader.Startup' threw an exception. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Error loading native library. Not found in any of the possible locations: C:\Users\rpajak\repos\opentelemetry-dotnet-instrumentation\bin\tracer-home\net461\grpc_csharp_ext.x86.dll,C:\Users\rpajak\repos\opentelemetry-dotnet-instrumentation\bin\tracer-home\net461\runtimes/win/native\grpc_csharp_ext.x86.dll,C:\Users\rpajak\repos\opentelemetry-dotnet-instrumentation\bin\tracer-home\net461\../..\runtimes/win/native\grpc_csharp_ext.x86.dll
   at Grpc.Core.Internal.UnmanagedLibrary.FirstValidLibraryPath(String[] libraryPathAlternatives)
   at Grpc.Core.Internal.UnmanagedLibrary..ctor(String[] libraryPathAlternatives)
   at Grpc.Core.Internal.NativeExtension.LoadUnmanagedLibrary()
   at Grpc.Core.Internal.NativeExtension.LoadNativeMethods()
   at Grpc.Core.Internal.NativeExtension..ctor()
   at Grpc.Core.Internal.NativeExtension.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 OpenTelemetry.Exporter.OtlpExporterOptionsExtensions.CreateChannel(OtlpExporterOptions options)
   at OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClient.OtlpGrpcTraceExportClient..ctor(OtlpExporterOptions options, ITraceServiceClient traceServiceClient)
   at OpenTelemetry.Exporter.OtlpExporterOptionsExtensions.GetTraceExportClient(OtlpExporterOptions options)
   at OpenTelemetry.Trace.OtlpTraceExporterHelperExtensions.AddOtlpExporter(TracerProviderBuilder builder, OtlpExporterOptions exporterOptions, Action`1 configure, IServiceProvider serviceProvider)
   at OpenTelemetry.Trace.OtlpTraceExporterHelperExtensions.AddOtlpExporter(TracerProviderBuilder builder, Action`1 configure)
   at OpenTelemetry.ClrProfiler.Managed.Configuration.EnvironmentConfigurationHelper.SetExporter(TracerProviderBuilder builder, Settings settings) in C:\Users\rpajak\repos\opentelemetry-dotnet-instrumentation\src\OpenTelemetry.ClrProfiler.Managed\Configuration\EnvironmentConfigurationHelper.cs:line 87
   at OpenTelemetry.ClrProfiler.Managed.Configuration.EnvironmentConfigurationHelper.UseEnvironmentVariables(TracerProviderBuilder builder, Settings settings) in C:\Users\rpajak\repos\opentelemetry-dotnet-instrumentation\src\OpenTelemetry.ClrProfiler.Managed\Configuration\EnvironmentConfigurationHelper.cs:line 22
   at OpenTelemetry.ClrProfiler.Managed.Instrumentation.Initialize() in C:\Users\rpajak\repos\opentelemetry-dotnet-instrumentation\src\OpenTelemetry.ClrProfiler.Managed\Instrumentation.cs:line 78
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)      
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)       
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, 
CultureInfo culture)
   at OpenTelemetry.ClrProfiler.Managed.Loader.Startup.TryLoadManagedAssembly() in C:\Users\rpajak\repos\opentelemetry-dotnet-instrumentation\src\OpenTelemetry.ClrProfiler.Managed.Loader\Startup.cs:line 63
   at OpenTelemetry.ClrProfiler.Managed.Loader.Startup..cctor() in C:\Users\rpajak\repos\opentelemetry-dotnet-instrumentation\src\OpenTelemetry.ClrProfiler.Managed.Loader\Startup.cs:line 29
   --- End of inner exception stack trace ---
   at OpenTelemetry.ClrProfiler.Managed.Loader.Startup..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& 
stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Reflection.Assembly.CreateInstance(String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at __DDVoidMethodType__.__DDVoidMethodCall__()
   at GitCredentialManager.Program.Main(String[] args)

Copy link
Contributor

@RassK RassK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth doing one per time. Eg let's start with .NET Core. Preprocessor directives could help in mean time setting the right default.

@nrcventura
Copy link
Member

Maybe worth doing one per time. Eg let's start with .NET Core. Preprocessor directives could help in mean time setting the right default.

It's definitely worth splitting this up into 2 parts. Supporting .NET Standard 2.1+ apps (and .NET core 3.1+) apps should be an easier place to start because the OTLP exporter relies on a fully "managed" grpc implementation. Supporting the older frameworks will require figuring out how to package and load some of the native dependencies for the older and now deprecated grpc library.

Another alternative approach is to consider just supporting OTLP via protobufs over HTTP (instead of grpc).

@pellared
Copy link
Member Author

pellared commented Feb 7, 2022

Closing per #343

@pellared pellared closed this Feb 7, 2022
@pellared pellared deleted the use-otlp-by-default branch February 7, 2022 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use OTLP HTTP/Protobuf Exporter by default
3 participants