opentelemetry

Configure OpenTelemetry traces, metrics, and logs in .NET 10 applications.

224|87|Updated Dec 15, 2018
One-click install
npx skills add https://github.com/Resgrid/Core --skill opentelemetry-resgrid
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: opentelemetry
Source: https://github.com/Resgrid/Core/tree/main/.opencode/skills/opentelemetry
Command: npx skills add https://github.com/Resgrid/Core --skill opentelemetry-resgrid

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the challenge of adding consistent, production-ready observability to .NET 10 applications so you can see traces, metrics, and logs across distributed systems.

Core Features & Use Cases

  • Unified OpenTelemetry setup: Configure traces, metrics, and logs through a single AddOpenTelemetry() call, with OTLP export via UseOtlpExporter().
  • Correct .NET metrics practices: Use IMeterFactory to create meters and prevent lifetime/leak issues in DI-based apps.
  • Reliable tracing instrumentation: Use custom ActivitySource spans with null-safe tagging, and register sources so spans are not silently dropped.
  • Operates cleanly by environment: Prefer OTEL_* environment variables to control telemetry routing and service identity without code changes.
  • Use Cases: Distributed tracing (spans/ActivitySource), custom metrics (counters/histograms/gauges), local validation with Aspire Dashboard, and production export to an OTLP-compatible collector or backend.

Quick Start

Tell the AI to help you wire up OpenTelemetry in Program.cs with tracing, metrics, OTLP log export, and OTEL_* environment variables for service name and collector endpoint.

Frequently Asked Questions about opentelemetry

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure OpenTelemetry traces, metrics, and logs in a .NET 10 application?

Use a single AddOpenTelemetry() call to configure tracing, metrics, and logs pipelines together, enable OTLP export via UseOtlpExporter(), and apply OTEL_* environment variables for service identity and routing.

Why are my custom ActivitySource spans being silently dropped in .NET?

Custom ActivitySource spans are silently dropped when their sources are not properly registered with the tracing pipeline. You must register your ActivitySource sources to ensure spans are captured and exported correctly.

What is the correct way to create meters for metrics in .NET dependency injection?

Use IMeterFactory to create meters in .NET DI-based apps. This prevents meter lifetime and memory leak issues that occur with manual instantiation when collecting custom metrics like counters and histograms.

Can I use environment variables to control OpenTelemetry routing without changing code?

Yes, you can use OTEL_* environment variables to control telemetry routing and service identity without code changes. This enables operational configuration of OTLP export endpoints and service metadata across different environments.

Does OpenTelemetry instrumentation work with HTTP client and EF Core in .NET 10?

Yes, OpenTelemetry instrumentation applies to web, HTTP client, EF Core, and runtime scenarios in .NET 10. It collects distributed traces, metrics, and logs across these components using OTLP export and custom ActivitySource spans.

What are the best practices for tagging metrics to avoid high cardinality in .NET?

Use low-cardinality metric tags to avoid high cardinality issues. High cardinality tags cause excessive memory usage and storage problems in your observability backend when exporting custom metrics via OTLP.