Add and maintain OpenTelemetry instrumentation across Copilot Chat agent flows.
Copy the install command and let the AI configure it · recommended for beginners
Please install the "otel" skill from askskill: 1. Download https://raw.githubusercontent.com/microsoft/vscode/main/.github/skills/otel/SKILL.md 2. Save it as ~/.claude/skills/otel/SKILL.md 3. Reload skills and tell me it's ready
Design an OpenTelemetry instrumentation plan for a new Copilot Chat agent execution entry point. Specify which spans, metrics, and events to add, the naming conventions to follow, and which monitoring docs should be updated.
A complete instrumentation checklist with telemetry items, naming conventions, and documentation update recommendations.
I changed the OTel span emission logic in the Copilot CLI bridge. Review whether the changes align with the existing IOTelService abstraction, span conventions, and the user/developer monitoring documentation.
A review report highlighting consistency issues, potential risks, and recommended fixes.
Based on the latest Claude span, metrics, and events implementation, draft an update outline for `extensions/copilot/docs/monitoring/agent_monitoring*.md`, including the mapping between code behavior and documentation.
A structured documentation outline listing telemetry fields, meanings, and their corresponding code locations.
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.
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.
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.
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 + FilteredSpanExporter + EXPORTABLE_OPERATION_NAMES
├── inMemoryOTelService.ts # InMemoryOTelService (used when OTel is disabled — feeds debug panel only)
├── fileExporters.ts # File-based span/log/metric exporters
└── sqlite/ # OTelSqliteStore + SqliteSpanExporter (dbSpanExporter pipeline)
extensions/copilot/src/extension/
├── chatSessions/
│ ├── copilotcli/node/
…
Validate Azure DevOps pipeline changes and troubleshoot builds and YAML faster.
Update the GitHub Copilot CLI or SDK to a newer version.
Upgrade Anthropic SDKs, migrate versions, and fix dependency or typing issues.
Generate or update chat customization files for AI coding agents.
Find and read Code OSS dev build logs for faster debugging.
Merge session branch changes back into the base branch cleanly.
Let AI query and analyze OpenTelemetry traces to debug apps faster.
Query and analyze telemetry data in natural language to find performance issues.
Attach redacted agent transcripts to GitHub PRs or issues for local provenance.
Automatically add redacted agent transcripts to GitHub PRs or issues.
Convert Lighthouse audits into fix packs for coding agents.
Analyze local-first AI agent CLI usage patterns and invocation data.