OpenTelemetry 1.20.0

Prefix Reserved
dotnet add package OpenTelemetry --version 1.20.0
                    
NuGet\Install-Package OpenTelemetry -Version 1.20.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OpenTelemetry" Version="1.20.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OpenTelemetry" Version="1.20.0" />
                    
Directory.Packages.props
<PackageReference Include="OpenTelemetry" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OpenTelemetry --version 1.20.0
                    
#r "nuget: OpenTelemetry, 1.20.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OpenTelemetry@1.20.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OpenTelemetry&version=1.20.0
                    
Install as a Cake Addin
#tool nuget:?package=OpenTelemetry&version=1.20.0
                    
Install as a Cake Tool

OpenTelemetry .NET SDK

NuGet NuGet

<details> <summary>Table of Contents</summary>

</details>

Installation

dotnet add package OpenTelemetry

Introduction

OpenTelemetry SDK is a reference implementation of the OpenTelemetry API. It implements the Logging API, Metrics API, Tracing API, Resource API, and the Context API. Once a valid SDK is installed and configured all the OpenTelemetry API methods, which were no-ops without an SDK, will start emitting telemetry. This SDK also ships with ILogger integration to automatically capture and enrich logs emitted using Microsoft.Extensions.Logging.

The SDK deals with concerns such as sampling, processing pipelines (exporting telemetry to a particular backend, etc.), metrics aggregation, and other concerns outlined in the OpenTelemetry Specification. In most cases, users indirectly install and enable the SDK when they install an exporter.

To learn how to set up and configure the OpenTelemetry SDK see: Getting started. For additional details about initialization patterns see: Initialize the SDK.

Self-Observability (Experimental)

The SDK can emit metrics about its own internal operations, enabling operators to monitor the health of the telemetry pipeline itself (e.g., detecting dropped telemetry due to queue overflow).

Self-observability metrics are experimental and may change in future releases. They are emitted under the meter name otel.sdk.experimental.

Opt-in

Self-observability metrics are only emitted when explicitly enabled by subscribing to the otel.sdk.experimental meter. There is no performance cost unless enabled.

var meterProvider = Sdk.CreateMeterProviderBuilder()
    .AddMeter("otel.sdk.experimental")
    .AddOtlpExporter() // or any exporter
    .Build();

Available Metrics

These metrics follow the OpenTelemetry SDK Self-Observability Semantic Conventions.

Metric Name Instrument Unit Description
otel.sdk.processor.log.processed Counter {log_record} Number of log records processed by the SDK, tagged with outcome.
otel.sdk.processor.span.processed Counter {span} Number of spans processed by the SDK, tagged with outcome.

Attributes

Attribute Description Example
otel.component.type The processor type. batching_log_processor, simple_log_processor, batching_span_processor, simple_span_processor
otel.component.name Unique instance identifier. batching_log_processor/0, batching_span_processor/0
error.type Present only on failure. queue_full, already_shutdown

When error.type is absent, the item was successfully accepted by the processor. This means the processor completed its intended handling of the item; for the Simple and Batching processors it is recorded when the item is handed to the exporter, and it does not indicate that the export itself succeeded or that the item reached the backend. Export failures are not reflected in this metric. When present:

  • queue_full - The batch processor's internal queue was full; the item was dropped.
  • already_shutdown - The processor had already been shut down; the item was lost.

Sampling affects otel.sdk.processor.span.processed as follows. Spans dropped by the sampler (DROP) are not counted, because span processors are not invoked for them at all. Spans sampled as RECORD_ONLY are counted as successfully processed because they do reach the processor and by design are never handed to an exporter.

Troubleshooting

All the components shipped from this repo uses EventSource for its internal logging. The name of the EventSource used by OpenTelemetry SDK is "OpenTelemetry-Sdk". To know the EventSource names used by other components, refer to the individual readme files.

While it is possible to view these logs using tools such as PerfView, dotnet-trace etc., this SDK also ships a self-diagnostics feature, which helps with troubleshooting.

Self-diagnostics

Self-diagnostics captures the internal logs of all OpenTelemetry components (every EventSource whose name starts with "OpenTelemetry-") and writes them to a rolling log file, to the console, or to both. It is disabled by default.

Self-diagnostics are not supported on browser-based platforms (e.g. Blazor WebAssembly).

The quickest way to enable it is with environment variables:

# Write to rolling log files in ./otel-logs
OTEL_DOTNET_SELF_DIAGNOSTICS_LOG_DIRECTORY=./otel-logs

# Or write to stdout and stderr instead, at a lower level
OTEL_DOTNET_SELF_DIAGNOSTICS_SINKS=stdout,stderr
OTEL_LOG_LEVEL=debug

MinimumLevel defaults to Warning, which is intended to be safe to leave enabled continuously; raise it only while investigating. This diverges from the OpenTelemetry specification default for OTEL_LOG_LEVEL (info) - set OTEL_LOG_LEVEL=info to take the specification default. With no sink enabled the SDK is silent at any level.

It can also be configured in code through the options pipeline:

services.Configure<SelfDiagnosticsOptions>(options =>
{
    options.MinimumLevel = LogLevel.Debug;
    options.LogDirectory = "/var/log/otel";
});

For the full reference - every option and environment variable, the output format, what to attach to a bug report, the environment variable redaction rules, and runtime reconfiguration - see: Troubleshooting.

The legacy OTEL_DIAGNOSTICS.json file mechanism still works but is superseded by the above and will be removed in a future major version. See Legacy self-diagnostics mechanism.

References

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (992)

Showing the top 5 NuGet packages that depend on OpenTelemetry:

Package Downloads
OpenTelemetry.Extensions.Hosting

Contains extensions to start OpenTelemetry in applications using Microsoft.Extensions.Hosting

OpenTelemetry.Exporter.OpenTelemetryProtocol

OpenTelemetry protocol exporter for OpenTelemetry .NET

OpenTelemetry.Exporter.Console

Console exporter for OpenTelemetry .NET

OpenTelemetry.Exporter.Prometheus.AspNetCore

ASP.NET Core middleware for hosting OpenTelemetry .NET Prometheus Exporter

OpenTelemetry.Instrumentation.GrpcNetClient

gRPC for .NET client instrumentation for OpenTelemetry .NET.

GitHub repositories (103)

Showing the top 20 popular GitHub repositories that depend on OpenTelemetry:

Repository Stars
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
dotnet/runtime
.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
dotnet/orleans
Cloud Native application framework for .NET
dotnetcore/CAP
Distributed transaction solution in micro-service base on eventually consistency, also an eventbus with Outbox pattern
quartznet/quartznet
Quartz Enterprise Scheduler .NET
Sylinko/Everywhere
On-screen aware AI assistant for your desktop. Uses current app context, multiple LLMs, and MCP tools to help you act across apps.
Azure/azure-sdk-for-net
This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
kurrent-io/KurrentDB
KurrentDB is a database that's engineered for modern software applications and event-driven architectures. Its event-native design simplifies data modeling and preserves data integrity while the integrated streaming engine solves distributed messaging challenges and ensures data consistency.
ChilliCream/graphql-platform
Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Nitro the awesome Monaco based GraphQL IDE.
dotnet/tye
Tye is a tool that makes developing, testing, and deploying microservices and distributed applications easier. Project Tye includes a local orchestrator to make developing microservices easier and the ability to deploy microservices to Kubernetes with minimal configuration.
modelcontextprotocol/csharp-sdk
The official C# SDK for Model Context Protocol servers and clients. Maintained in collaboration with Microsoft.
thomhurst/TUnit
A modern, fast and flexible .NET testing framework
microsoft/kiota
OpenAPI based HTTP Client code generator
npgsql/npgsql
Npgsql is the .NET data provider for PostgreSQL.
Arcenox-co/TickerQ
TickerQ is a fast, reflection-free background task scheduler for .NET built with source generators, EF Core integration, cron + time-based execution, and a real-time dashboard.
JasperFx/marten
.NET Transactional Document DB and Event Store on PostgreSQL
linq2db/linq2db
Linq to database provider.
microsoft/Generative-AI-for-beginners-dotnet
Five lessons, learn how to really apply AI to your .NET Applications
BrighterCommand/Brighter
A framework for building messaging apps with .NET and C#.
JasperFx/wolverine
Supercharged .NET server side development!
Version Downloads Last Updated
1.20.0 26,893 10/15/2026
1.20.0-rc.1 249 10/15/2026
1.19.1 5,345,387 9/21/2026
1.19.1-rc.1 295 9/21/2026
1.19.0 678,030 9/18/2026
1.19.0-rc.1 261 9/18/2026
1.18.0 9,257,110 8/21/2026
1.18.0-rc.1 347 8/21/2026
1.17.0 14,586,799 7/16/2026
1.17.0-rc.1 722 7/16/2026
1.16.0 18,321,468 6/10/2026
1.16.0-rc.1 963 6/10/2026
1.15.3 81,019,805 4/21/2026
1.15.2 3,333,782 4/8/2026
1.15.1 5,982,755 3/27/2026
1.15.0 25,291,896 1/21/2026
1.14.0 35,359,844 11/12/2025
1.14.0-rc.1 110,414 10/21/2025
1.13.1 14,111,287 10/9/2025
1.13.0 2,765,180 10/1/2025 1.13.0 is deprecated because it has critical bugs.
Loading failed