opentelemetry

Installation
SKILL.md

OpenTelemetry

Core Principles

  1. Three pillars, one setup — Configure traces, metrics, and logs through a single AddOpenTelemetry() call. Use UseOtlpExporter() for cross-cutting export to any OTLP-compatible backend.
  2. Use IMeterFactory for metrics — Never create Meter instances with new. The factory manages lifetime through DI and prevents leaks.
  3. Null-safe activitiesStartActivity() returns null when no listener is attached. Always use ?. when setting tags or events.
  4. Environment variables over code — Use OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_SERVICE_NAME so deployments control telemetry routing without code changes.
  5. Low-cardinality metric tags — Keep metric tag combinations under ~1000 per instrument. Use span attributes or logs for high-cardinality data like user IDs or request IDs.

Patterns

Full Setup with All Three Signals

// Program.cs
var builder = WebApplication.CreateBuilder(args);
Installs
33
GitHub Stars
435
First Seen
Mar 13, 2026
opentelemetry — codewithmukesh/dotnet-claude-kit