OpenTelemetryExtension.Instrumentation.Monitor
1.1.6
dotnet add package OpenTelemetryExtension.Instrumentation.Monitor --version 1.1.6
NuGet\Install-Package OpenTelemetryExtension.Instrumentation.Monitor -Version 1.1.6
<PackageReference Include="OpenTelemetryExtension.Instrumentation.Monitor" Version="1.1.6" />
<PackageVersion Include="OpenTelemetryExtension.Instrumentation.Monitor" Version="1.1.6" />
<PackageReference Include="OpenTelemetryExtension.Instrumentation.Monitor" />
paket add OpenTelemetryExtension.Instrumentation.Monitor --version 1.1.6
#r "nuget: OpenTelemetryExtension.Instrumentation.Monitor, 1.1.6"
#:package OpenTelemetryExtension.Instrumentation.Monitor@1.1.6
#addin nuget:?package=OpenTelemetryExtension.Instrumentation.Monitor&version=1.1.6
#tool nuget:?package=OpenTelemetryExtension.Instrumentation.Monitor&version=1.1.6
OpenTelemetryExtension.Instrumentation.Monitor
A helper library to quickly configure OpenTelemetry for .NET with three extension methods:
AddOpentelemetryTraces(...): configures tracing (AspNetCore + HttpClient + OTLP exporter).AddOpentelemetryLogs(...): configures Serilog OpenTelemetry sink to send logs to your OpenTelemetry Collector.AddOpentelemetryMetrics(...): configures metrics (AspNetCore + HttpClient + OTLP exporter).
Installation
dotnet add package OpenTelemetryExtension.Instrumentation.Monitor
Quick Start
In Program.cs:
using OpenTelemetryExtension.Instrumentation.Monitor;
using Serilog;
var builder = WebApplication.CreateBuilder(args);
var serviceName = "my-service";
var environment = builder.Environment.EnvironmentName;
// Traces endpoint (custom URL is supported)
builder.Services.AddOpentelemetryTraces(
serviceName: serviceName,
endpoint: "endpoint Traces for You",
enviroment: environment);
// Logs endpoint (custom URL is supported)
builder.Services.AddOpentelemetryLogs(
serviceName: serviceName,
endpoint: "endpoint Logs for You",
enviroment: environment);
// Metrics endpoint (custom URL is supported)
builder.Services.AddOpentelemetryMetrics(
serviceName: serviceName,
endpoint: "endpoint Metrics for You",
enviroment: environment);
// If your app uses Serilog as the main logger:
builder.Host.UseSerilog();
var app = builder.Build();
app.MapGet("/", () => "OK");
app.Run();
If enviroment is null, the library auto-resolves environment from
DOTNET_ENVIRONMENT or ASPNETCORE_ENVIRONMENT.
Parameters
serviceName: service name shown in your observability backend.endpoint: OTLP collector endpoint.enviroment: deployment environment (Development/Staging/Production).
Note: the current API parameter name is
enviroment(kept as-is to match the package methods).
Default Instrumentation
AddOpentelemetryTraces(...) enables:
AddAspNetCoreInstrumentation()AddHttpClientInstrumentation()AddOtlpExporter(...)
AddOpentelemetryLogs(...) configures:
Serilog.Sinks.OpenTelemetry- protocol:
HttpProtobuf - resource attributes:
service.name,deployment.environment
AddOpentelemetryMetrics(...) enables:
AddAspNetCoreInstrumentation()AddHttpClientInstrumentation()AddOtlpExporter(...)- resource attributes:
host.name,deployment.environment
Infrastructure Requirement
You need an OpenTelemetry Collector (or any OTLP-compatible backend) to receive traces/logs/metrics.
Default local collector ports are commonly:
- OTLP gRPC:
4317 - OTLP HTTP/protobuf:
4318
Your deployment can use custom URLs/ports, including endpoints without an explicit port
(for example: http://domain/v1/traces).
Example endpoints:
- Traces endpoint:
endpoint Traces for You - Logs endpoint:
endpoint Logs for You - Metrics endpoint:
endpoint Metrics for You
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 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 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. |
-
net8.0
- Confluent.Kafka.Extensions.OpenTelemetry (>= 0.3.0)
- OpenTelemetry (>= 1.9.0)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.9.0)
- OpenTelemetry.Extensions.Hosting (>= 1.9.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.9.0)
- OpenTelemetry.Instrumentation.Http (>= 1.9.0)
- OpenTelemetry.Instrumentation.SqlClient (>= 1.9.0-beta.1)
- OpenTelemetry.Instrumentation.StackExchangeRedis (>= 1.9.0-beta.1)
- Serilog.Extensions.Logging (>= 8.0.0)
- Serilog.Sinks.OpenTelemetry (>= 3.0.0)
- Swashbuckle.AspNetCore (>= 6.4.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.