
Otel
Instrument Copilot Chat agent paths with OpenTelemetry spans, metrics, and events while keeping monitoring docs aligned with code.
Install
npx skills add https://github.com/microsoft/vscode --skill otelWhat is this skill?
- Maps four agent execution paths plus Copilot CLI bridge and Claude span emission
- Centers on IOTelService abstraction and span/metric/event naming conventions
- Treats agent_monitoring.md and agent_monitoring_arch.md as source-of-truth contracts
- Requires syncing code changes with user and developer monitoring docs
- References otel-data-flow.html for bridge and data-flow visualization
Adoption & trust: 50 installs on skills.sh; 186k GitHub stars; 3/3 security scanners passed (skills.sh audits).
Recommended Skills
Microsoft Foundrymicrosoft/azure-skills
Azure Aimicrosoft/azure-skills
Azure Hosted Copilot Sdkmicrosoft/azure-skills
Lark Eventlarksuite/cli
Running Claude Code Via Litellm Copilotxixu-me/skills
Setup Matt Pocock Skillsmattpocock/skills
Journey fit
Primary fit
Telemetry is added while extending the Copilot Chat agent surfaces and IOTelService—not a launch or growth marketing task. Spans cover four agent execution paths, CLI bridge, and Claude emission—core agent-tooling work inside the extension codebase.
Common Questions / FAQ
Is Otel safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Otel
# OpenTelemetry Instrumentation Skill When adding, changing, or reviewing OTel telemetry in the Copilot Chat extension, **always read the two source-of-truth docs first** and **always keep them in sync with the code you change**. ## 1. Authoritative Documents The `extensions/copilot/docs/monitoring/` directory contains the two specs that define the OTel contract for the extension. Treat them like the layout / layer specs in `vs/sessions`. | Document | Path | Audience | Covers | |---|---|---|---| | User-facing | `extensions/copilot/docs/monitoring/agent_monitoring.md` | Extension users | Quick start, settings, env vars, exported spans/metrics/events, backend setup guides | | Architecture | `extensions/copilot/docs/monitoring/agent_monitoring_arch.md` | Developers | Multi-agent strategies, span hierarchies, file structure, instrumentation points, `IOTelService`, configuration channels | | Visual flow | `extensions/copilot/docs/monitoring/otel-data-flow.html` | Developers | Renders the bridge data flow for the in-process Copilot CLI agent | If the implementation changes, **you must update the relevant doc in the same PR**. The arch doc is the most likely to drift; treat divergence as a bug. ## 2. Architecture at a Glance The extension has four agent execution paths, each with a different OTel strategy: | Agent | Process Model | Strategy | Debug Panel Source | |---|---|---|---| | **Foreground** (`toolCallingLoop`) | Extension host | Direct `IOTelService` spans | Extension spans | | **Copilot CLI in-process** | Extension host (same process) | **Bridge SpanProcessor** — SDK creates spans natively; bridge forwards to debug panel | SDK native spans via bridge | | **Copilot CLI terminal** | Separate terminal process | Forward OTel env vars | N/A (separate process) | | **Claude Code** | Child process (Node fork) | **Synthesized from SDK messages** — extension intercepts the Claude SDK message stream in `claudeMessageDispatch.ts` and emits GenAI spans; LLM calls are proxied through `claudeLanguageModelServer.ts` (which calls `chatMLFetcher`, producing standard `chat` spans). | Extension spans | > **Why asymmetric?** The CLI SDK runs in-process with full trace hierarchy (subagents, permissions, hooks). A bridge captures this directly. Claude runs as a separate process — internal spans are inaccessible, so the extension synthesizes spans by translating SDK messages and proxying the model API. ## 3. Where Things Live (canonical map) ``` extensions/copilot/src/platform/otel/ ├── common/ │ ├── otelService.ts # IOTelService interface + ISpanHandle + injectCompletedSpan │ ├── otelConfig.ts # Config resolution (env → settings → defaults), enabledVia, dbSpanExporter │ ├── noopOtelService.ts # Zero-cost no-op (used by chatLib / tests) │ ├── inMemoryOTelService.ts # ← actually under node/, see below │ ├── agentOTelEnv.ts # deriveCopilotCliOTelEnv / deriveClaudeOTelEnv │ ├── genAiAttributes.ts # ⚠ Single source of truth for attribute keys & enums │ ├── genAiEvents.ts # Event emitter helpers (emit*Event) │ ├── genAiMetrics.ts # GenAiMetrics class │ ├── messageFormatters.ts # truncateForOTel, normalizeProviderMessages, toSystemInstructions, … │ ├── workspaceOTelMetadata.ts │ ├── sessionUtils.ts │ └── index.ts # ⚠ Public barrel — re-export new helpers/constants here └── node/ ├── otelServiceImpl.ts # NodeOTelService + DiagnosticSpanExporter + FilteredSpanEx