Shared.OpenTelemetry
1.0.0
dotnet add package Shared.OpenTelemetry --version 1.0.0
NuGet\Install-Package Shared.OpenTelemetry -Version 1.0.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="Shared.OpenTelemetry" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Shared.OpenTelemetry" Version="1.0.0" />
<PackageReference Include="Shared.OpenTelemetry" />
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 Shared.OpenTelemetry --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Shared.OpenTelemetry, 1.0.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 Shared.OpenTelemetry@1.0.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=Shared.OpenTelemetry&version=1.0.0
#tool nuget:?package=Shared.OpenTelemetry&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Shared.OpenTelemetry
A comprehensive .NET 9 library for configuring OpenTelemetry observability (logging, metrics, and tracing) in ASP.NET Core and Worker Service applications.
Features
- Easy Setup: Simple two-line integration with ASP.NET Core
- Multi-Environment Support: Automatic configuration for Development, Kubernetes-Aspire, and Kubernetes-Mixed environments
- Comprehensive Telemetry: Logging, metrics, and distributed tracing out-of-the-box
- Extensible: Support for custom activity sources and meters
- Production Ready: Built on OpenTelemetry 1.14.0 with .NET 9 support
Quick Start
ASP.NET Core Applications
var builder = WebApplication.CreateBuilder(args);
// Add OpenTelemetry observability
builder.AddObservability();
var app = builder.Build();
// Configure observability middleware
app.UseObservability();
app.Run();
That's it! Your application now has comprehensive observability configured with:
- Request/response logging and metrics
- Distributed tracing
- Prometheus metrics endpoint at
/metrics - Console logging for development
Custom Telemetry
Add your own metrics and tracing:
// Custom activity source
public class MyActivitySource : IActivitySource
{
public ActivitySource ActivitySource { get; } = new("MyApp.Operations", "1.0.0");
public string Name => ActivitySource.Name;
}
// Custom meter
public class MyMeter : IMeter
{
public string Name => "MyApp.Metrics";
public string? Version => "1.0.0";
public Meter Meter { get; } = new("MyApp.Metrics", "1.0.0");
public Counter<int> RequestCounter { get; }
public MyMeter()
{
RequestCounter = Meter.CreateCounter<int>("requests_total");
}
}
// Register with your application
builder.AddObservability(
activitySources: new[] { new MyActivitySource() },
meters: new[] { new MyMeter() }
);
Environment Configuration
The library automatically detects your environment and configures appropriate endpoints:
- Development: Uses
http://aspire-dashboard:18889for all telemetry (logs, traces, metrics) - Production: Uses
http://aspire.aspire.svc.cluster.local:18889for all telemetry in Kubernetes - Other environments: Falls back to console exporters for logs/traces and Prometheus for metrics
Requirements
- .NET 9.0 or later
- ASP.NET Core (for web applications)
Links
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 was computed. 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.
-
net9.0
- OpenTelemetry.Exporter.Console (>= 1.14.0)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.14.0)
- OpenTelemetry.Exporter.Prometheus.AspNetCore (>= 1.9.0-beta.2)
- OpenTelemetry.Extensions.Hosting (>= 1.14.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.14.0)
- OpenTelemetry.Instrumentation.Http (>= 1.14.0)
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.0 | 331 | 11/23/2025 | |
| 1.0.0-users-davhar-nugt.org... | 218 | 11/23/2025 |