Skip to content

Add OpenTelemetry instrumentation infrastructure for observability#3424

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/add-opentelemetry-integration
Draft

Add OpenTelemetry instrumentation infrastructure for observability#3424
Copilot wants to merge 4 commits intomainfrom
copilot/add-opentelemetry-integration

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

Adds OpenTelemetry-based observability infrastructure for VS Code Copilot Chat agent, modeled after Gemini CLI's telemetry system.

Changes

Core Service Interface

  • IOpenTelemetryService with typed attributes for tool calls, API requests, agent lifecycle, file operations
  • NullOpenTelemetryService for zero-overhead disabled state
  • FileOpenTelemetryService writes JSON lines to configurable output file

Configuration

New settings under github.copilot.chat.openTelemetry.*:

  • enabled, target, otlpEndpoint, otlpProtocol, outfile, logPrompts

Privacy-first: logPrompts: false (default) excludes user prompts from telemetry.

Event Types

Logs:    copilot_chat.{config,user_prompt,tool_call,api_request,api_response,agent.start,agent.finish}
Metrics: copilot_chat.{session.count,tool.call.count,tool.call.latency,token.usage,agent.duration}
Spans:   Session, API request, and tool invocation with parent-child relationships

Usage

{
  "github.copilot.chat.openTelemetry.enabled": true,
  "github.copilot.chat.openTelemetry.outfile": "~/.copilot/telemetry.log"
}

Output format (JSON lines):

{"timestamp":"...","type":"log","name":"copilot_chat.tool_call","attributes":{"function_name":"read_file","success":true,"tool_type":"native"},"common":{"session.id":"...","installation.id":"..."}}

Files

  • src/platform/telemetry/common/openTelemetryService.ts - Interface + types
  • src/platform/telemetry/common/nullOpenTelemetryService.ts - Disabled impl
  • src/platform/telemetry/node/fileOpenTelemetryService.ts - File output impl
  • src/platform/telemetry/vscode-node/openTelemetryServiceImpl.ts - Config-aware wrapper
  • Service registered in src/extension/extension/vscode-node/services.ts

Not Included

  • Actual instrumentation callsites (tool loop, API handlers, agent lifecycle)
  • OTLP HTTP/gRPC exporters (only file output implemented)

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 4, 2026 01:20
Co-authored-by: zhichli <57812115+zhichli@users.noreply.github.com>
Co-authored-by: zhichli <57812115+zhichli@users.noreply.github.com>
Co-authored-by: zhichli <57812115+zhichli@users.noreply.github.com>
Copilot AI changed the title [WIP] Add OpenTelemetry instrumentation for vscode copilot chat agent Add OpenTelemetry instrumentation infrastructure for observability Feb 4, 2026
Copilot AI requested a review from zhichli February 4, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants