Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

opentelemetry-net-instrumentation

БесплатноБез исполняемых скриптовНе проверен

Provides guidance for implementing OpenTelemetry instrumentation in .NET codebases, covering tracing (Activities/Spans), metrics, logs, naming conventions…

Aarononthewebот Aaronontheweb★ 1 284 звезды на GitHub

Об этом скилле

OpenTelemetry .NET Instrumentation Skill

When to Use

  • Adding OpenTelemetry instrumentation to .NET code (traces, metrics, logs)
  • Creating or modifying ActivitySources, Meters, or ILogger usage
  • Setting up the OpenTelemetry SDK, resources, exporters, or sampling
  • Reviewing telemetry implementations for spec compliance
  • Optimizing instrumentation performance
  • Designing telemetry APIs that become part of the public surface
  • Implementing context propagation across service boundaries

Architecture: .NET Is Different

CRITICAL: The .NET OpenTelemetry implementation is fundamentally different from other platforms. .NET provides tracing, metrics, and logging APIs in the framework itself. That means OTel does not provide a separate instrumentation API — it uses the built-in .NET APIs and acts as the collection/export layer.

The Three Built-in .NET APIs (Primary — Zero Dependencies)

Signal .NET Framework API Namespace
Tracing ActivitySource / Activity System.Diagnostics
Metrics Meter / Counter<T> / Histogram<T> / etc. System.Diagnostics.Metrics
Logging ILogger<T> Microsoft.Extensions.Logging

These are the primary and only APIs library authors should use for instrumentation. They ship with the .NET runtime — no NuGet packages required.

The OTel Collection/Export Layer (Secondary — Application Root Only)

OTel NuGet packages are the collection and export layer, added only at the application composition root (not in libraries):

Package Purpose When to add
OpenTelemetry.Extensions.Hosting DI integration for ASP.NET Core / generic host Application only
OpenTelemetry.Exporter.Console Console exporter (dev/testing) Application only
OpenTelemetry.Exporter.OpenTelemetryProtocol OTLP exporter (production) Application only
OpenTelemetry.Exporter.Prometheus* Prometheus metrics endpoint Application only
OpenTelemetry.Instrumentation.AspNetCore Auto-instrument ASP.NET Core requests Application only
OpenTelemetry.Instrumentation.Http Auto-instrument HttpClient calls Application only
OpenTelemetry.Instrumentation.SqlClient Auto-instrument SQL calls Application only

Package Decision Guide

Before adding ANY OpenTelemetry NuGet package, discuss the trade-off with the user:

"You're about to add an OTel NuGet package. Is this an application where you need to export telemetry to an observability backend (Jaeger, Prometheus, OTLP collector)? If you're writing a library, you likely need zero OTel packages — just use System.Diagnostics.ActivitySource / System.Diagnostics.Metrics.Meter and let the consuming application configure the export pipeline. Do you want to proceed?"

Library authors: Add nothing. Use only System.Diagnostics.* and ILogger. The consuming application wires up the SDK and exporters.

Application authors: Add OpenTelemetry.Extensions.Hosting + the exporters and instrumentation libraries you need. See sdk-resources-and-logs-reference.md for full setup patterns.

Never add OpenTelemetry.Api to a library — System.Diagnostics.* IS the API.

For SDK setup, resource configuration, exporters, sampling, and logs integration, see sdk-resources-and-logs-reference.md.

Core Principles

Resiliency First

CRITICAL: Exceptions in diagnostic/tracing/metrics logic MUST NEVER impact application processing.

  • Assume Activity instances can be null. Always protect against null Activity references except in Activity extension methods (use activity?.ExtensionMethod())
  • Guard all instrumentation code with appropriate null checks

API Surface Awareness

  • Any telemetry emitted becomes part of the public API surface
  • Changes are subject to breaking changes guidelines
  • Telemetry should be emitted by default (users opt-in to collection via OpenTelemetry extensions)
  • Exception: High-cardinality metric dimensions may require explicit opt-in

Standards Compliance

Traces / Spans (Activities)

ActivitySource Setup

// ✅ CORRECT: Use ActivitySource, not DiagnosticSource
public clas
Полный SKILL.md на GitHub

Установить opentelemetry-net-instrumentation в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

metrics-and-instruments-reference.mdsdk-resources-and-logs-reference.mdtraces-and-propagation-reference.md

FAQ

Что делает скилл opentelemetry-net-instrumentation?

Provides guidance for implementing OpenTelemetry instrumentation in .NET codebases, covering tracing (Activities/Spans), metrics, logs, naming conventions, error handling, performance, SDK setup, resources, context propagation, and API design best practices.

Как установить скилл opentelemetry-net-instrumentation?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл opentelemetry-net-instrumentation запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить opentelemetry-net-instrumentation с