OpenTelemetry 1.21.0-rc.1

OpenTelemetry .NET SDK

NuGet NuGet

Table of Contents

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).

Note

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.

Note

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.

Note

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

See the troubleshooting guide for setup examples using environment variables, appsettings.json, or code, along with the full options reference, runtime configuration changes, and guidance on reading and sharing diagnostic output. It also covers the legacy OTEL_DIAGNOSTICS.json configuration mechanism.

References

Showing the top 20 packages that depend on OpenTelemetry.

Packages Downloads
OpenTelemetry.Exporter.OpenTelemetryProtocol
OpenTelemetry protocol exporter for OpenTelemetry .NET
2,069
OpenTelemetry.Extensions.Hosting
Contains extensions to start OpenTelemetry in applications using Microsoft.Extensions.Hosting
685
OpenTelemetry.Extensions.Hosting
Contains extensions to start OpenTelemetry in applications using Microsoft.Extensions.Hosting
169
OpenTelemetry.Exporter.Prometheus.AspNetCore
ASP.NET Core middleware for hosting OpenTelemetry .NET Prometheus Exporter
168
OpenTelemetry.Exporter.OpenTelemetryProtocol
OpenTelemetry protocol exporter for OpenTelemetry .NET
63
OpenTelemetry.Exporter.Console
Console exporter for OpenTelemetry .NET
61
OpenTelemetry.Instrumentation.Http
Http instrumentation for OpenTelemetry .NET
60
OpenTelemetry.Exporter.OpenTelemetryProtocol
OpenTelemetry protocol exporter for OpenTelemetry .NET
57
OpenTelemetry.Exporter.Console
Console exporter for OpenTelemetry .NET
56
OpenTelemetry.Exporter.OpenTelemetryProtocol
OpenTelemetry protocol exporter for OpenTelemetry .NET
56
OpenTelemetry.Instrumentation.StackExchangeRedis
StackExchange.Redis instrumentation for OpenTelemetry .NET
55
OpenTelemetry.Exporter.Console
Console exporter for OpenTelemetry .NET
55
OpenTelemetry.Extensions.Hosting
Contains extensions to start OpenTelemetry in applications using Microsoft.Extensions.Hosting
55
Azure.Monitor.OpenTelemetry.Exporter
An OpenTelemetry .NET exporter that exports to Azure Monitor
54
OpenTelemetry.Extensions.Hosting
Contains extensions to start OpenTelemetry in applications using Microsoft.Extensions.Hosting
54
OpenTelemetry.Exporter.Console
Console exporter for OpenTelemetry .NET
54

For highlights and announcements see: https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.21.0-rc.1/RELEASENOTES.md.

    For detailed changes see: https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.21.0-rc.1/src/OpenTelemetry/CHANGELOG.md.

Version Downloads Last updated
1.21.0-rc.1 10 10/28/2026
1.20.1 15 10/20/2026
1.20.1-rc.1 9 10/20/2026
1.20.0 14 10/16/2026
1.20.0-rc.1 11 10/15/2026
1.19.1 17 09/23/2026
1.19.1-rc.1 23 09/21/2026
1.19.0 20 09/18/2026
1.19.0-rc.1 23 09/18/2026
1.18.0 28 08/21/2026
1.18.0-rc.1 22 08/21/2026
1.17.0 164 07/18/2026
1.17.0-rc.1 28 07/19/2026
1.16.0 29 06/13/2026
1.16.0-rc.1 32 06/13/2026
1.15.3 2,057 04/24/2026
1.15.2 42 04/08/2026
1.15.1 53 03/27/2026
1.15.0 54 01/24/2026
1.14.0 7 09/27/2026
1.14.0-rc.1 61 12/11/2025
1.13.1 50 12/12/2025
1.13.0 46 12/20/2025
1.12.0 717 09/28/2026
1.11.2 53 12/14/2025
1.11.1 41 12/18/2025
1.11.0 44 12/12/2025
1.11.0-rc.1 44 12/13/2025
1.10.0 47 12/13/2025
1.10.0-rc.1 8 10/01/2026
1.10.0-beta.1 44 12/14/2025
1.9.0 56 12/15/2025
1.9.0-rc.1 47 12/11/2025
1.9.0-alpha.1 40 12/13/2025
1.8.1 5 10/04/2026
1.8.0 44 12/20/2025
1.8.0-rc.1 5 09/29/2026
1.8.0-beta.1 48 12/20/2025
1.7.0 41 12/14/2025
1.7.0-rc.1 52 12/25/2025
1.7.0-alpha.1 33 12/11/2025
1.6.0 40 12/14/2025
1.6.0-rc.1 35 12/13/2025
1.6.0-alpha.1 39 12/12/2025
1.5.1 15 09/30/2026
1.5.0 40 12/20/2025
1.5.0-rc.1 40 12/16/2025
1.5.0-alpha.2 41 12/15/2025
1.5.0-alpha.1 36 12/14/2025
1.4.0 49 12/11/2025
1.4.0-rc.4 38 12/14/2025
1.4.0-rc.3 38 12/12/2025
1.4.0-rc.2 47 12/14/2025
1.4.0-rc.1 36 12/13/2025
1.4.0-beta.3 46 12/11/2025
1.4.0-beta.2 11 10/08/2026
1.4.0-beta.1 53 12/14/2025
1.4.0-alpha.2 41 12/14/2025
1.4.0-alpha.1 34 12/14/2025
1.3.2 53 12/12/2025
1.3.1 56 12/11/2025
1.3.0 41 12/14/2025
1.3.0-rc.2 46 12/14/2025
1.3.0-beta.2 38 12/14/2025
1.3.0-beta.1 70 12/14/2025
1.2.0 47 12/14/2025
1.2.0-rc5 40 12/12/2025
1.2.0-rc4 45 12/13/2025
1.2.0-rc3 34 12/12/2025
1.2.0-rc2 36 12/12/2025
1.2.0-rc1 35 12/12/2025
1.2.0-beta2.1 4 09/28/2026
1.2.0-beta1 34 12/24/2025
1.2.0-alpha4 40 12/14/2025
1.2.0-alpha3 37 12/22/2025
1.2.0-alpha2 31 12/29/2025
1.2.0-alpha1 45 12/20/2025
1.1.0 48 12/14/2025
1.1.0-rc1 38 12/14/2025
1.1.0-beta4 39 12/23/2025
1.1.0-beta3 50 12/29/2025
1.1.0-beta2 48 12/29/2025
1.1.0-beta1 39 12/23/2025
1.0.1 52 12/13/2025
1.0.0-rc4 30 12/14/2025
1.0.0-rc3 38 12/14/2025
1.0.0-rc2 47 12/15/2025
1.0.0-rc1.1 38 12/14/2025
0.8.0-beta.1 46 12/11/2025
0.7.0-beta.1 42 12/20/2025
0.6.0-beta.1 46 12/11/2025
0.5.0-beta.2 50 12/11/2025
0.4.0-beta.2 62 12/12/2025
0.3.0-beta.1 51 12/12/2025
0.2.0-alpha.275 42 12/12/2025
0.2.0-alpha.220 34 12/12/2025
0.2.0-alpha.179 31 12/12/2025
0.2.0-alpha.100 32 12/20/2025
0.2.0-alpha.40 32 12/20/2025
0.2.0-alpha.5 35 12/12/2025