OpenTelemetry guidance for VS Code agent experiences. Use when changing Agent Host telemetry, local Copilot Chat telemetry, provider-native spans or metrics, OTel settings and managed policy, trace persistence/export, or monitoring documentation.
93%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
The canonical home for this skill is otel in microsoft/vscode
Start by identifying the execution surface. VS Code has separate OTel pipelines with different owners and configuration:
| Surface | Process and producer | Configuration | Authoritative VS Code document |
|---|---|---|---|
| Agent Host sessions (Copilot, Claude, Codex) | Provider-native telemetry routed by the Agent Host utility process | chat.agentHost.otel.* | src/vs/platform/agentHost/OTEL.md |
| Local Copilot Chat | Copilot Chat extension host and IOTelService | github.copilot.chat.otel.* | extensions/copilot/docs/monitoring/agent_monitoring.md |
Do not combine these pipelines or assume that a setting for one configures another.
Agent Host is the current execution architecture for Copilot, Claude, and Codex agent sessions. It owns routing, optional trace interception and SQLite persistence, resource normalization, and cross-provider trace context. Each provider owns its native instrumentation.
The extension-host Copilot CLI source remains as a fallback when Agent Host is unavailable and to support legacy-session migration. It is normally hidden when Agent Host is available and is not the current Agent Host architecture. Do not use it as a model for new work.
Local Copilot Chat remains a separate user-visible extension-host surface. Its foreground chat, LLM, tool, hook, metric, and event instrumentation continues to use IOTelService under extensions/copilot/src/platform/otel/.
Copilot's native OTel signal contract lives in github/copilot-agent-runtime, not in VS Code's TypeScript attribute constants. Before auditing or changing the integration:
@github/copilot-sdk and @github/copilot from the root package-lock.json.main only after confirming that the relevant files are unchanged from the bundled revision.The runtime's docs/developer-docs/monitor.md is exhaustive for native Copilot spans, attributes, span events, metrics, protocols, environment variables, content capture, TLS, and managed settings. Read it at the revision corresponding to the bundled package and link to that immutable revision in investigation or review evidence rather than copying its signal tables into VS Code documentation.
src/vs/platform/agentHost/
├── OTEL.md
├── common/
│ ├── agentService.ts # setting IDs, env names, settings → env translation
│ └── otel/agentHostOTelService.ts # service contract and synthetic span names
├── electron-main/electronAgentHostStarter.ts # Electron spawn-time env binding
├── node/
│ ├── nodeAgentHostStarter.ts # server spawn-time env binding
│ ├── otel/agentHostOTelService.ts # pass-through and DB-mode routing
│ ├── copilot/ # Copilot SDK configuration and trace context
│ ├── claude/ # Claude launch environment
│ └── codex/ # Codex launch overrides
└── test/node/otel/ # pipeline integration testsShared transport and persistence live under:
src/vs/platform/otel/
├── common/ # normalized span data and shared attributes
└── node/
├── otlp/ # receiver, decoder, outbound forwarders
└── sqlite/ # persistent span storeAgent Host supports two routing modes:
Read src/vs/platform/agentHost/OTEL.md before changing either mode.
extensions/copilot/src/platform/otel/
├── common/ # IOTelService, config, attributes, events, metrics
└── node/ # SDK implementation and exporters
extensions/copilot/src/extension/
├── prompt/node/chatMLFetcher.ts # chat spans
├── intents/node/toolCallingLoop.ts # invoke_agent spans
├── tools/vscode-node/toolsService.ts # execute_tool spans
├── chat/vscode-node/chatHookService.ts # execute_hook spans
├── byok/vscode-node/ # BYOK chat spans
└── trajectory/vscode-node/ # Agent Debug Log conversionFor extension-emitted attributes, use constants from extensions/copilot/src/platform/otel/common/genAiAttributes.ts. Those constants are not authoritative for provider-native Agent Host telemetry.
When changing Agent Host configuration:
common/agentHostStarter.config.contribution.ts.buildAgentHostOTelEnv() in common/agentService.ts.readAgentHostOTelEnv() or provider launch translation as applicable.src/vs/platform/agentHost/OTEL.md.policy-and-managed-settings skill for any enterprise control.When changing local Copilot Chat configuration:
extensions/copilot/package.json.resolveOTelConfig() in extensions/copilot/src/platform/otel/common/otelConfig.ts.agent_monitoring.md.Never add a new VS Code setting merely to mirror a new runtime-owned managed setting. Follow the runtime-managed-settings ownership rules.
For Agent Host provider-native signals:
For host-produced spans:
common/otel/agentHostOTelService.ts or shared platform constants.service.namespace=vscode.agent-host while retaining distinct provider service names.traceparent and tracestate through the provider's supported boundary.For local Copilot Chat signals:
IOTelService, not directly on an OTel SDK from consumers.gen_ai.* keys when they exist.github.copilot.*; do not add new copilot_chat.* keys.truncateForOTel with the configured maximum.Do not claim one protocol matrix for every Agent Host provider:
otel.* overrides.Check the provider launch code and bundled provider version before documenting support.
src/vs/platform/agentHost/OTEL.md.extensions/copilot/docs/monitoring/agent_monitoring.md.Choose the smallest checks that cover the change.
Agent Host examples:
./scripts/test.sh --grep "AgentHostOTel\|agent host.*OTel"
./scripts/test-integration.sh --run src/vs/platform/agentHost/test/node/otel/agentHostOTelService.integrationTest.tsLocal Copilot Chat examples, from extensions/copilot/:
npx tsc --noEmit --project tsconfig.json
npm test -- --grep "OTel"For documentation-only changes, verify:
main matches the package bundled by VS Code.posit-dev/positron
f854bb8
Canonical home
since Oct 24, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.