microsoft/agents/agents-sdk-dotnet-otel
Claude Code and agent skill by microsoft/agents
- vendor
Checking that the SKILL.md file is still in the repository.
Use when adding, configuring, validating, or troubleshooting OpenTelemetry observability for a Microsoft 365 Agents SDK application in C# / .NET. Trigger when the user mentions OpenTelemetry, OTel, telemetry, traces, metrics, logs, OTLP, Aspire Dashboard, Application Insights, Azure Monitor, distributed tracing, custom ActivitySource or Meter instrumentation, or observing Microsoft.Agents.Core signals.
Install
npx vskill@latest install microsoft/agents/agents-sdk-dotnet-otelSKILL.md
The same SKILL.md was published earlier as microsoft/agents/agents-sdk-dotnet-otel.
OpenTelemetry for Agents SDK (.NET)
Goal
Configure traces, metrics, and logs for an Agents SDK application, including the SDK's built-in Microsoft.Agents.Core signals and a local Aspire Dashboard. Make the smallest complete change that fits the existing hosting and telemetry architecture.
Use this skill for both AgentApplication and ActivityHandler applications. The SDK telemetry source is the same for both.
Non-negotiable rules
- Inspect the project before editing. Reuse and extend an existing
AddOpenTelemetry() registration instead of creating competing providers.
- Register telemetry before
builder.Build()and before the app processes
agent requests.
- Subscribe to both
AgentsTelemetry.SourceNameand
AgentsTelemetry.Meter; the SDK has no direct OpenTelemetry dependency and publishes through System.Diagnostics.
- Give the application its own stable
service.name. Do not use
Microsoft.Agents.Core as the service name; that is an instrumentation source, not the application's identity.
- Use OTLP environment variables rather than embedding collector URLs,
headers, API keys, or connection strings in source code.
- Never capture message text, prompts, responses, access tokens,
authorization headers, cookies, secrets, attachment contents, user names, user IDs, conversation IDs, activity IDs, or arbitrary HTTP headers by default.
- Keep metric attributes low-cardinality. Good dimensions include route type,
activity type, channel ID, operation, status, and error type. Do not put per-user, per-conversation, per-message, URL, or exception-message values on metrics.
- Do not add
AlwaysOnSampleras a production default. Honor the standard
OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG configuration.
- Aspire Dashboard anonymous mode is local-development only. Bind its ports to
loopback and do not deploy that configuration.
- Telemetry must never swallow application exceptions or turn failures into
successful results.
Workflow
Complete these steps in order.
1. Inspect the application
Find:
- The web or generic-host project (
*.csproj) and target framework. Program.csor the host-builder entry point.- Existing calls to
AddOpenTelemetry,ConfigureOpenTelemetry,
UseAzureMonitor, AddOtlpExporter, AddApplicationInsightsTelemetry, or custom observability extensions.
- Existing
ActivitySource,Meter, counters, histograms, and logging setup. - Existing OTEL settings in
appsettings*.json, launch profiles, environment
files, container definitions, or deployment manifests.
- Whether package versions are centrally managed in
Directory.Packages.props.
If OpenTelemetry already exists, merge the Agents SDK source and meter into that registration. Do not replace existing exporters or instrumentation without a reason.
2. Add only the required packages
Use the repository's package-management convention. Keep all OpenTelemetry packages on a compatible stable version. When versions are not centrally managed, these commands select the latest stable packages:
Do not add the console exporter unless the user explicitly wants console telemetry. Do not add Azure Monitor packages unless Azure Monitor export is requested.
3. Configure the providers
Prefer a project-local extension such as AgentOtelExtensions.cs. Adapt the namespace and service name to the project:
Notes:
- If the project does not expose
/health, keeping the filter is harmless. - If an existing telemetry extension already adds ASP.NET Core, HTTP client,
runtime, or OTLP instrumentation, add only the missing AgentsTelemetry.SourceName source and meter.
- Do not manually add
"Microsoft.AspNetCore"or"System.Net.Http"activity
source strings when the corresponding instrumentation packages are already configured.
service.nameshould identify the application, for example
contoso-support-agent. Keep it stable across instances.
- Use
service.versionfor the deployed build/version when one is available. - Use resource attributes such as
deployment.environment.namefor stable
deployment metadata, not request-specific data.
Call the extension before the agent registrations:
If no custom application telemetry is needed, omit applicationTelemetrySource and do not create AgentTelemetry.
4. Configure OTLP without secrets in source
For a local Aspire Dashboard using OTLP/gRPC:
Standard environment variables to support:
| Variable | Purpose | |
|---|---|---|
OTEL_SERVICE_NAME | Stable application service name | |
OTEL_RESOURCE_ATTRIBUTES | Stable resource metadata | |
OTEL_EXPORTER_OTLP_ENDPOINT | Base OTLP collector endpoint | |
OTEL_EXPORTER_OTLP_PROTOCOL | Usually grpc or http/protobuf | |
OTEL_EXPORTER_OTLP_HEADERS | Collector authentication headers; keep secret | |
OTEL_TRACES_SAMPLER | Trace sampling strategy | |
OTEL_TRACES_SAMPLER_ARG | Sampling strategy argument |
Use user secrets, a secret store, or deployment secrets for OTEL_EXPORTER_OTLP_HEADERS and Azure Monitor connection strings. Never place them in committed appsettings.json or launch profiles.
5. Add custom business telemetry only when useful
The Agents SDK already emits adapter, turn, route, connector, storage, authentication, and authorization signals. Add custom telemetry for application-specific operations, not to duplicate those SDK spans.
Use one shared source name for the application's custom traces and metrics:
Instrument a handler with bounded attributes:
If AddException is unavailable for the project's package version, add an exception activity event using the OpenTelemetry semantic attributes. Do not log or tag the prompt, response, or exception message as a metric dimension.
6. Set up the Aspire Dashboard
Copy assets/start-aspire-dashboard.ps1 from this skill into a suitable local development or scripts directory. The script pulls mcr.microsoft.com/dotnet/aspire-dashboard:latest.
Run:
Then open http://localhost:18888. The script:
- Binds the UI and OTLP ports to
127.0.0.1. - Exposes OTLP/gRPC on
4317and OTLP/HTTP on4318. - Enables unsecured access only for local development.
- Runs the dashboard in a disposable Docker container.
Do not start a second container if aspire-dashboard already exists. Inspect or reuse the existing container instead. Stop the generated local dashboard with:
7. Validate end to end
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 16 Sep 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingagent-plugins/agents-for-net/skills/agents-sdk-dotnet-otel/SKILL.md
Popularity
- Repository stars
- 1,066
- Repository forks
- 340
- 7-day trend score
- 35
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/microsoft/agents/agents-sdk-dotnet-otel)