codewithmukesh/dotnet-claude-kit/opentelemetry
Claude Code and agent skill by codewithmukesh/dotnet-claude-kit
- community
Checking that the SKILL.md file is still in the repository.
OpenTelemetry observability for .NET 10 applications. Covers traces, metrics, and logs using the OpenTelemetry SDK with OTLP export. Includes custom ActivitySource, IMeterFactory metrics, resource configuration, and Aspire Dashboard integration. Load this skill when setting up distributed tracing, custom metrics, OTLP export, or when the user mentions "OpenTelemetry", "OTLP", "traces", "spans", "Activity", "ActivitySource", "metrics", "IMeterFactory", "Meter", "Counter", "Histogram", "Gauge", "…
Install
npx vskill@latest install codewithmukesh/dotnet-claude-kit/opentelemetrySKILL.md
The same SKILL.md was published earlier as codewithmukesh/dotnet-claude-kit/opentelemetry.
OpenTelemetry
Core Principles
- Three pillars, one setup — Configure traces, metrics, and logs through a single
AddOpenTelemetry()call. UseUseOtlpExporter()for cross-cutting export to any OTLP-compatible backend. - Use `IMeterFactory` for metrics — Never create
Meterinstances withnew. The factory manages lifetime through DI and prevents leaks. - Null-safe activities —
StartActivity()returnsnullwhen no listener is attached. Always use?.when setting tags or events. - Environment variables over code — Use
OTEL_EXPORTER_OTLP_ENDPOINTandOTEL_SERVICE_NAMEso deployments control telemetry routing without code changes. - 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
The OTLP endpoint defaults to http://localhost:4317 (gRPC). Override via:
Custom Metrics with IMeterFactory
Register a metrics class as a singleton. IMeterFactory handles Meter disposal through DI.
Multi-Dimensional Metric Tags
Three or fewer tags are allocation-free. For more, use TagList.
Custom ActivitySource for Distributed Tracing
Register the source: .AddSource("MyApp.Orders") in the tracing builder.
Aspire Dashboard for Local Development
Run the standalone Aspire Dashboard without Aspire orchestration:
Then point your app at it:
Dashboard UI is at http://localhost:18888.
Source-Generated Logging with OTel
For maximum performance, use [LoggerMessage] — eliminates boxing and allocations.
OpenTelemetry logging automatically includes TraceId and SpanId when an Activity is current.
Anti-patterns
Don't Create Meters Per Request
Don't Skip Null Checks on Activity
Don't Use High-Cardinality Metric Tags
Don't Mix UseOtlpExporter with AddOtlpExporter
Don't Forget to Register Custom Sources
Decision Guide
| Scenario | Recommendation | |
|---|---|---|
| Full observability setup | AddOpenTelemetry() with all three signals + UseOtlpExporter() | |
| Custom business metrics | IMeterFactory + singleton metrics class | |
| Custom trace spans | ActivitySource + StartActivity() | |
| Local development backend | Aspire Dashboard standalone container | |
| Production backend | OTel Collector as intermediary to Grafana/Datadog/etc. | |
| Sampling in production | OTEL_TRACES_SAMPLER=parentbased_traceidratio with 10% ratio | |
| High-performance logging | [LoggerMessage] source generator | |
| Metric tag cardinality | Max ~1000 combinations per instrument | |
| Environment configuration | OTEL_* env vars (also work via appsettings.json) |
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/opentelemetry/SKILL.md
Popularity
- Repository stars
- 845
- Repository forks
- 184
- 7-day trend score
- 32
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/codewithmukesh/dotnet-claude-kit/opentelemetry)