OpenTelemetryExtension.Configuration 1.0.2

dotnet add package OpenTelemetryExtension.Configuration --version 1.0.2
                    
NuGet\Install-Package OpenTelemetryExtension.Configuration -Version 1.0.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="OpenTelemetryExtension.Configuration" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OpenTelemetryExtension.Configuration" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="OpenTelemetryExtension.Configuration" />
                    
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 OpenTelemetryExtension.Configuration --version 1.0.2
                    
#r "nuget: OpenTelemetryExtension.Configuration, 1.0.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 OpenTelemetryExtension.Configuration@1.0.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=OpenTelemetryExtension.Configuration&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=OpenTelemetryExtension.Configuration&version=1.0.2
                    
Install as a Cake Tool

OpenTelemetryExtension.Configuration

.NET Standard 2.1 License NuGet Version NuGet Downloads Coverage Status CI Tests Star this repo

Configurable OpenTelemetry setup for ASP.NET Core via appsettings.json — tracing, metrics and logging with a single AddTelemetry() call.


⭐ Features

  • Tracing: ASP.NET Core, HttpClient and SqlClient instrumentation out of the box.
  • Metrics: ASP.NET Core, HttpClient and .NET runtime metrics.
  • Logging: Structured log export via OpenTelemetry Protocol (OTLP).
  • Flexible configuration: Bind from appsettings.json or configure inline in code.
  • Extensible: Register custom instrumentation via ConfigureTracing, ConfigureMetrics and ConfigureLogging callbacks.
  • Protocol support: HTTP/protobuf (port 4318) and gRPC (port 4317).

🚀 Getting Started

Installation

Install via NuGet:

dotnet add package OpenTelemetryExtension.Configuration

Register in Service Collection

Option A — via appsettings.json
builder.Services.AddTelemetry(builder.Configuration);
{
  "Telemetry": {
    "Endpoint": "http://localhost:4318",
    "ServiceName": "my-api",
    "EnvironmentName": "production"
  }
}
Option B — inline in code
builder.Services.AddTelemetry(o =>
{
    o.Endpoint        = new Uri("http://localhost:4318");
    o.ServiceName     = "my-api";
    o.EnvironmentName = "production";
});

⚙️ Configuration Reference

All options can be set via appsettings.json under the Telemetry key.

Property Type Default Description
Enabled bool true Disables all telemetry when false.
Endpoint Uri (required) OTLP collector endpoint, e.g. http://localhost:4318.
Headers string "" Exporter headers, e.g. Authorization=Basic .... Format: key1=value1,key2=value2.
Protocol string Grpc OTLP protocol. Valid values: HttpProtobuf, Grpc.
ServiceName string? null Service name reported to the backend.
EnvironmentName string? null Reported as deployment.environment resource attribute.
EnableTracing bool true Enables distributed tracing.
EnableMetrics bool true Enables metrics collection.
EnableLogging bool true Enables log export.
EnableAspNetCoreInstrumentation bool true Instruments incoming HTTP requests.
EnableHttpClientInstrumentation bool true Instruments outgoing HttpClient requests.
EnableSqlClientInstrumentation bool true Instruments SQL database calls.
EnableRuntimeInstrumentation bool true Collects GC, memory and thread pool metrics.
RecordExceptions bool true Records exceptions with stack traces on spans.
ExcludeHealthChecks bool true Excludes /health endpoints from tracing.

Note: ConfigureTracing, ConfigureMetrics and ConfigureLogging callbacks are only available when configuring inline in code — they cannot be set via appsettings.json.


🔌 Custom Instrumentation

Register additional instrumentation libraries via the callbacks:

builder.Services.AddTelemetry(o =>
{
    o.Endpoint = new Uri("http://localhost:4318");

    // e.g. MySQL, Redis, MongoDB, ...
    o.ConfigureTracing = tracing => tracing.AddSource("MyApp");
    o.ConfigureMetrics = metrics => metrics.AddMeter("MyApp");
    o.ConfigureLogging = logging => logging.AddConsole();
});

📡 Backend Examples

Run the helm charts or use docker deploy with the cmd scripts. See the deploy folder for all configuration files and startup scripts, and the sample project for the corresponding appsettings configurations.

.NET Aspire Dashboard

{
  "Telemetry": {
    "Endpoint": "http://localhost:18888",
    "Protocol": "HttpProtobuf"
  }
}

Jaeger

{
  "Telemetry": {
    "Endpoint": "http://localhost:4318",
    "Protocol": "HttpProtobuf"
  }
}

SigNoz

{
  "Telemetry": {
    "Endpoint": "http://localhost:50709"
  }
}

OpenSearch

{
  "Telemetry": {
    "Endpoint": "http://localhost:30318",
    "Protocol": "HttpProtobuf"
  }
}

Grafana Loki

Loki supports OTLP for logs only. Tracing and metrics must be disabled.

{
  "Telemetry": {
    "Endpoint": "http://localhost:3100/otlp",
    "Protocol": "HttpProtobuf",
    "EnableTracing": false,
    "EnableMetrics": false
  }
}

OpenObserve — HTTP/protobuf

{
  "Telemetry": {
    "Endpoint": "http://localhost:30117/api/default",
    "Protocol": "HttpProtobuf",
    "Headers": "Authorization=Basic <base64>,stream-name=default"
  }
}

OpenObserve — gRPC

{
  "Telemetry": {
    "Endpoint": "http://localhost:30118",
    "Protocol": "Grpc",
    "Headers": "Authorization=Basic <base64>,organization=default,stream-name=default"
  }
}

🤝 How to Contribute

Contributions are welcome! If you'd like to improve the project, please:

  1. Check out our contributing guidelines.
  2. Ideally, open an issue before starting work.
  3. Submit a pull request with your changes.

Thank you for helping make OpenTelemetryExtension.Configuration better!


🐞 Report a Bug

If you encounter any issues or bugs, please report them here.


For additional licensing and attribution details, see NOTICE.md and THIRD_PARTY_LICENSES.md.

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 was computed.  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 was computed.  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 was computed. 
.NET Framework net461 was computed.  net462 was computed.  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

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
1.0.2 96 6/1/2026
1.0.1 98 5/28/2026
1.0.0 95 5/28/2026