← ClaudeAtlas

opentelemetrylisted

OpenTelemetry SDK for .NET — tracing, custom spans, metrics, .NET Aspire integration, and OTLP exporter configuration.
zdanovichnick/dotnet-pilot · ★ 3 · AI & Automation · score 76
Install: claude install-skill zdanovichnick/dotnet-pilot
# OpenTelemetry for .NET Reference material for adding distributed tracing and metrics to ASP.NET Core services. Used by `dnp-architect` and `dnp-tdd-developer-hard`. ## NuGet Packages ```xml <!-- Core --> <PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.*" /> <!-- Tracing instrumentation --> <PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.*" /> <PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.*" /> <PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.*" /> <PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.*" /> <!-- Exporter --> <PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.*" /> ``` ## Setup — Program.cs ```csharp builder.Services.AddOpenTelemetry() .WithTracing(tracing => tracing .AddAspNetCoreInstrumentation(options => { options.RecordException = true; options.Filter = ctx => ctx.Request.Path != "/health"; // exclude health checks }) .AddEntityFrameworkCoreInstrumentation(options => { options.SetDbStatementForText = true; // include SQL in spans (dev only) }) .AddHttpClientInstrumentation() .AddSource("MyApp.Orders") // register custom ActivitySource names .AddOtlpExporter()) .WithMetrics(metrics => metrics .AddAspNetCoreInstrumentation() .AddRuntimeInstrum