Czlovek.Telemetry 3.0.0-beta.2

This is a prerelease version of Czlovek.Telemetry.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Czlovek.Telemetry --version 3.0.0-beta.2
                    
NuGet\Install-Package Czlovek.Telemetry -Version 3.0.0-beta.2
                    
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="Czlovek.Telemetry" Version="3.0.0-beta.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Czlovek.Telemetry" Version="3.0.0-beta.2" />
                    
Directory.Packages.props
<PackageReference Include="Czlovek.Telemetry" />
                    
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 Czlovek.Telemetry --version 3.0.0-beta.2
                    
#r "nuget: Czlovek.Telemetry, 3.0.0-beta.2"
                    
#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 Czlovek.Telemetry@3.0.0-beta.2
                    
#: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=Czlovek.Telemetry&version=3.0.0-beta.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Czlovek.Telemetry&version=3.0.0-beta.2&prerelease
                    
Install as a Cake Tool

Telemetry

Wires up OpenTelemetry tracing, metrics and logging for an ASP.NET Core service, and provides a small abstraction (MetricsManager) for defining custom application metrics.

Usage

Configuring OpenTelemetry

builder.Logging.ClearProviders();   // optional; must come before AddTelemetry
builder.AddTelemetry();

AddTelemetry registers ASP.NET Core and HttpClient instrumentation for tracing and metrics, runtime and process metrics, and the OpenTelemetry logger, and exports all three via OTLP. Call it after builder.Logging.ClearProviders(), which would otherwise remove the OpenTelemetry logger again.

The older pair builder.Services.AddTelemetry(builder.Configuration) + builder.UseTelemetry() still works but is obsolete: forgetting the second call silently drops all logs.

Where the data goes. The standard OpenTelemetry environment variables win: when OTEL_EXPORTER_OTLP_ENDPOINT is set (as .NET Aspire does for every project), the exporters use it together with OTEL_EXPORTER_OTLP_PROTOCOL and OTEL_EXPORTER_OTLP_HEADERS, and Telemetry:OtlpEndpoint/Protocol are ignored. When OTEL_SERVICE_NAME is set, it names the service and OTEL_RESOURCE_ATTRIBUTES (for example Aspire's service.instance.id) is kept; ServiceName from configuration then only names the meter and the trace source. Without those variables the Telemetry section is used:

{
  "Telemetry": {
    "OtlpEndpoint": "http://otel-collector:4317",
    "ServiceName": "MyService",
    "ServiceVersion": "1.0.0",
    "ServiceNamespace": "Czlovek.Services",
    "Protocol": "grpc"
  }
}

Custom metrics

Derive from MetricsManager to define your own counters, gauges and histograms backed by a System.Diagnostics.Metrics.Meter:

public class OrdersMetrics(ITelemetryConfig config, ILogger<MetricsManager> logger)
    : MetricsManager(config, logger)
{
    public CounterInstrument<long> OrdersCreated { get; } = CreateCounter<long>("orders_created");
}

Instrument names are automatically prefixed with the entry assembly name and converted to snake_case.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-beta.10 50 11/22/2026
3.0.0-beta.9 51 11/22/2026
3.0.0-beta.8 61 11/21/2026
3.0.0-beta.6 107 9/29/2026
3.0.0-beta.5 91 9/27/2026
3.0.0-beta.4 64 9/27/2026
3.0.0-beta.3 69 9/27/2026
3.0.0-beta.2 69 9/27/2026
3.0.0-beta.1 101 7/19/2026
2.1.0-beta.85 140 6/16/2026
2.1.0-beta.84 88 5/7/2026
2.1.0-beta.83 87 5/7/2026
2.1.0-beta.82 143 3/20/2026
2.1.0-beta.81 103 2/21/2026
2.1.0-beta.80 101 2/21/2026
2.1.0-beta.79 111 2/13/2026
2.1.0-beta.78 117 2/11/2026
2.1.0-beta.77 108 2/11/2026
2.1.0-beta.76 92 2/10/2026
2.1.0-beta.75 125 2/10/2026
Loading failed