Instrumentation Libraries for OpenTelemetry .NET
OpenTelemetry is an observability framework that provides APIs, SDKs, and tools for generating and collecting application telemetry data such as metrics, logs, and traces. OpenTelemetry .NET is a language-specific implementation of OpenTelemetry for .NET applications and services.
OpenTelemetry .NET offers two ways of instrumenting applications: automatic and manual instrumentation.
Automatic Instrumentation
Automatic instrumentation allows sending traces and metrics from .NET applications and services without modifying their source code. The OpenTelemetry .NET Automatic Instrumentation supports a wide variety of libraries, and all instrumentations are enabled by default for all signal types (traces, metrics, and logs).
To disable all instrumentations for a specific signal type, set the OTEL_DOTNET_AUTO_{SIGNAL}_INSTRUMENTATION_ENABLED
environment variable to false
. To disable specific instrumentations for a given signal type, set the OTEL_DOTNET_AUTO_{SIGNAL}_{0}_INSTRUMENTATION_ENABLED
environment variable to false
, where {SIGNAL}
is the type of signal (e.g., TRACES) and {0}
is the index of the instrumentation.
Available instrumentations include:
- MySqlData Instrumentation (source)
- OWIN Instrumentation (source)
- Process Instrumentation (source)
- QuartzNET Instrumentation (source)
- .NET runtime metrics instrumentation (source)
- Hangfire Instrumentation (source)
- HttpClient and HttpWebRequest instrumentation (source)
- AWS SDK client instrumentation (source)
- MassTransit Instrumentation (source)
- SqlClient Instrumentation (source)
- StackExchange.Redis Instrumentation (source)
- WCF Instrumentation (source)
For more information on automatic instrumentation, refer to the documentation.
Manual Instrumentation
Manual instrumentation involves adding observability code to an app yourself. To instrument an app, use the OpenTelemetry SDK for your language and initialize OpenTelemetry and the API to instrument your code. This will emit telemetry from your app and any library you installed that also comes with instrumentation.
For more information on manual instrumentation, refer to the documentation.
Instrumenting Libraries
When instrumenting libraries, only install the OpenTelemetry API package for your language. Your library will not emit telemetry on its own. It will only emit telemetry when it is part of an app that uses the OpenTelemetry SDK.
For more information on instrumenting libraries, refer to the documentation.
Getting Started
To get started with OpenTelemetry .NET, follow the Getting Started Guide.
For examples of different instrumentation scenarios covered by the OpenTelemetry .NET Automatic Instrumentation, refer to the examples.
For more information on the OpenTelemetry .NET ecosystem, refer to the ecosystem registry.
For more information on OpenTelemetry .NET, refer to the documentation.