You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenTelemetry .NET Auto-Instrumentation dynamically loads OpenTelemetry .NET SDK and its instrumentation to user process and helps collect telemetry from an application without modifying the code. Issue happens when the application has a reference to OpenTelemetry SDK and user want to enable Auto-Instrumentation. In this case both user application and Auto-Instrumentation will have its own instance of TracerProvider or MeterProvider and could collect duplicate telemetries.
Describe the solution you'd like:
Auto-Instrumentation uses .NET startup hook to load the OpenTelemetry SDK and initialize TracerProvider/MeterProvider before the main application's entry point. SDK providing an option to disable the creation of the TracerProvider/MeterProvider for user-initiated providers should solve this issue. This could be implemented by adding a static bool flag in TracerProvider/ MeterProvider to stop creation of these providers. This flag can be private or public, auto-instrumentation has ability to set this through reflection. If customer use auto-instrumentation, this flag could be set by auto-instrumentation in startup and it will avoid creation of TracerProvider from user application.
Feature Request
Is your feature request related to a problem?
OpenTelemetry .NET Auto-Instrumentation dynamically loads OpenTelemetry .NET SDK and its instrumentation to user process and helps collect telemetry from an application without modifying the code. Issue happens when the application has a reference to OpenTelemetry SDK and user want to enable Auto-Instrumentation. In this case both user application and Auto-Instrumentation will have its own instance of
TracerProvider
orMeterProvider
and could collect duplicate telemetries.Describe the solution you'd like:
Auto-Instrumentation uses .NET startup hook to load the OpenTelemetry SDK and initialize
TracerProvider
/MeterProvider
before the main application's entry point. SDK providing an option to disable the creation of theTracerProvider
/MeterProvider
for user-initiated providers should solve this issue. This could be implemented by adding a static bool flag inTracerProvider
/MeterProvider
to stop creation of these providers. This flag can be private or public, auto-instrumentation has ability to set this through reflection. If customer use auto-instrumentation, this flag could be set by auto-instrumentation in startup and it will avoid creation of TracerProvider from user application.Additional Context
open-telemetry/opentelemetry-dotnet-instrumentation#633
cc: @open-telemetry/dotnet-instrumentation-approvers
The text was updated successfully, but these errors were encountered: