OpenTelemetry .NET - open-telemetry/opentelemetry-dotnet

OpenTelemetry .NET

OpenTelemetry is an observability framework that generates and collects application telemetry data such as metrics, logs, and traces. The .NET implementation of OpenTelemetry, OpenTelemetry .NET, is a language-specific implementation of OpenTelemetry in .NET. This document provides an overview of the OpenTelemetry .NET project, its design philosophy, dependencies, and available options.

Key Technologies and Dependencies

  • .NET: OpenTelemetry .NET supports all officially supported versions of .NET and .NET Framework 3.5 SP1.
  • NuGet: OpenTelemetry .NET is distributed as NuGet packages.
  • GitHub Actions: OpenTelemetry .NET uses GitHub Actions for continuous integration and delivery.
  • OpenTelemetry Protocol (OTLP): OpenTelemetry .NET provides OpenTelemetry Protocol (OTLP) exporters for telemetry data delivery.
  • Prometheus, Zipkin, gRPC, System.Net.Http.HttpClient and System.Net.HttpWebRequest, Microsoft.Data.SqlClient and System.Data.SqlClient: OpenTelemetry .NET supports various exporters and transports for telemetry data delivery.

Getting Started

To get started with OpenTelemetry .NET, follow the Getting Started Guide. The guide provides a step-by-step process to set up OpenTelemetry .NET in your application.

Instrumentation

OpenTelemetry .NET provides two types of instrumentation: automatic and manual.

Automatic Instrumentation

Automatic instrumentation allows you to get telemetry for your app in less than 5 minutes. OpenTelemetry .NET supports automatic instrumentation for a wide variety of libraries. For a complete list, see Instrumentations. To enable automatic instrumentation, set the following environment variables to true before launching your application:

  • OTEL_DOTNET_AUTO_LOGS_CONSOLE_EXPORTER_ENABLED
  • OTEL_DOTNET_AUTO_METRICS_CONSOLE_EXPORTER_ENABLED
  • OTEL_DOTNET_AUTO_TRACES_CONSOLE_EXPORTER_ENABLED

For more information, see OpenTelemetry .NET SDK and OpenTelemetry Specification.

Manual Instrumentation

Manual instrumentation allows you to customize the telemetry data collection for your application. For more information, see Manual Instrumentation Guide.

Exporters

To visualize and analyze your telemetry, you will need to export your data to an OpenTelemetry Collector or a backend such as Jaeger, Zipkin, Prometheus, or a vendor-specific one. OpenTelemetry .NET provides many exporters for OTLP and other common protocols. For more information, see Exporters Guide.

Resources

Vendors

An alternative to using OpenTelemetry .NET directly is to use a vendor’s distribution of OpenTelemetry. These distributions can save you time and effort by providing technical support, preconfigured popular features, up-to-date OpenTelemetry versions, and best practices. For a list of OpenTelemetry vendors, see Vendors.