GitHub Copilot Integration
Trace GitHub Copilot agent turns, LLM calls, and tool calls in VS Code and the Copilot CLI using Copilot's built-in OpenTelemetry export. No extension or SDK needed.
GitHub Copilot already exports OpenTelemetry data: agent turns, LLM calls, tool executions, token usage, and the AI credits each call used. Traccia ingests that data natively on the hosted platform. Point Copilot at Traccia, work as usual, and open the dashboard to see which tools ran, which models answered, what it would cost at API prices, and how turns roll up into conversations. It works with Copilot Chat in VS Code and the GitHub Copilot CLI.
Zero code changes
A few VS Code settings or environment variables. No extension, no SDK, no changes to your repos.
Conversations become sessions
Every turn in the same Copilot conversation is grouped into one Traccia session.
Tool-level visibility
Each model call and each tool call is its own span, with tokens, timing, and failures.
Honest cost labels
Copilot is billed by plan, so Traccia shows a labeled API-equivalent estimate, not a bill.
No collector required
1Get a Traccia API key
Sign in to app.traccia.ai, open Settings, then API Keys, and create an ingestion key. Copy the key. You will paste it into Copilot's settings in the next step.
2Configure Copilot in VS Code
Open your user settings (Command Palette, then Preferences: Open User Settings (JSON)) and add the following. Replace YOUR_TRACCIA_API_KEY with your key. The endpoint is the standard OTLP base path: Copilot appends /v1/traces, /v1/metrics, and /v1/logs itself.
HTTP (recommended)
{ "github.copilot.chat.otel.enabled": true, "github.copilot.chat.otel.exporterType": "otlp-http", "github.copilot.chat.otel.otlpEndpoint": "https://api.traccia.ai/otel", "github.copilot.chat.otel.headers": { "Authorization": "Bearer YOUR_TRACCIA_API_KEY" }, "github.copilot.chat.otel.captureContent": true}User settings, then reload
.vscode/settings.json. Copilot reads them at startup: run Developer: Reload Window after saving. The headers setting stores your key in plain text, so keep it out of settings you sync or share.Agent mode: set environment variables
The settings above trace Copilot Chat's own model calls. Agent mode runs in Copilot's bundled runtime, which reads only environment variables and only when VS Code starts. Set these, quit every VS Code window, and start VS Code from the same shell. Encode the space after Bearer as %20, as the OpenTelemetry spec requires.
export COPILOT_OTEL_ENABLED=trueexport OTEL_EXPORTER_OTLP_ENDPOINT=https://api.traccia.ai/otelexport OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer%20YOUR_TRACCIA_API_KEY"export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=truecode .$env:COPILOT_OTEL_ENABLED = "true"$env:OTEL_EXPORTER_OTLP_ENDPOINT = "https://api.traccia.ai/otel"$env:OTEL_EXPORTER_OTLP_HEADERS = "Authorization=Bearer%20YOUR_TRACCIA_API_KEY"$env:OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT = "true"code .Quit VS Code first
code . reuses that running instance and the variables never reach Copilot's runtime.To set them once on Windows, save them as user environment variables, then quit and reopen VS Code. Any launch, including the Start menu, picks them up. They also apply to any other app that reads the standard OTEL_EXPORTER_OTLP_* variables.
setx COPILOT_OTEL_ENABLED "true"setx OTEL_EXPORTER_OTLP_ENDPOINT "https://api.traccia.ai/otel"setx OTEL_EXPORTER_OTLP_HEADERS "Authorization=Bearer%20YOUR_TRACCIA_API_KEY"setx OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT "true"On macOS and Linux, VS Code opened from the Dock or an app menu does not read your shell profile. Add the export lines to ~/.zshrc or ~/.bashrc and start VS Code with code from a terminal.
If your Copilot Chat has no github.copilot.chat.otel.headers setting, remove that line from settings.json. The environment variables above supply the key.
gRPC
Copilot Chat's own calls can also go over gRPC on port 4317. Agent mode always uses OTLP/HTTP through the environment variables. For the general gRPC reference, see Platform OTLP Ingestion.
{ "github.copilot.chat.otel.enabled": true, "github.copilot.chat.otel.exporterType": "otlp-grpc", "github.copilot.chat.otel.otlpEndpoint": "https://api.traccia.ai:4317", "github.copilot.chat.otel.headers": { "Authorization": "Bearer YOUR_TRACCIA_API_KEY" }, "github.copilot.chat.otel.captureContent": true}3Configure the Copilot CLI (optional)
The GitHub Copilot CLI is configured with environment variables. It exports over OTLP/HTTP (JSON by default, or protobuf with OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf); it has no gRPC option. Sign in once with copilot login, then set these in the shell you run copilot from, or in your shell profile:
export COPILOT_OTEL_ENABLED=trueexport OTEL_EXPORTER_OTLP_ENDPOINT=https://api.traccia.ai/otelexport OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer%20YOUR_TRACCIA_API_KEY"export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=truecopilot$env:COPILOT_OTEL_ENABLED = "true"$env:OTEL_EXPORTER_OTLP_ENDPOINT = "https://api.traccia.ai/otel"$env:OTEL_EXPORTER_OTLP_HEADERS = "Authorization=Bearer%20YOUR_TRACCIA_API_KEY"$env:OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT = "true"copilotSame variables as VS Code agent mode
OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_HEADERS also take precedence over the VS Code settings, so point them at the same Traccia endpoint.4Run Copilot and open Traccia
Use Copilot as you normally would. In VS Code, open Copilot Chat in agent mode; in a terminal, start the CLI:
copilotAsk it to do real work: read files, run commands, edit code. Copilot exports spans in batches every few seconds, and each turn is complete once the turn finishes.
In Traccia, go to Traces and look for the agent GitHub Copilot (id github-copilot). Click any trace to open the full timeline. Your first trace usually appears within seconds of a turn completing.
What gets captured
- An
invoke_agentspan per agent turn. In the CLI each turn is its own trace. In VS Code each chat session is one trace, rooted at VS Code'svscode.agent_host.sessionspan, with oneinvoke_agentper prompt inside it. - A
chatspan per LLM call, with the model and input, output, cached, and reasoning tokens. - An
execute_toolspan per tool call, with the tool name, and its arguments and result when content capture is on. - Prompts and responses on each LLM span when content capture is on.
- Subagents appear as nested spans under the same Copilot agent, not as separate agents.
- Surface. Each trace is tagged IDE (VS Code) or CLI.
- Git context (VS Code). When Copilot Chat reports the repository and branch, they are shown on the trace. The CLI does not send git details.
VS Code may also emit hook spans for Copilot hooks, and the CLI emits a plan span when it plans a task. Both appear in the timeline.
Sessions
Copilot tags every turn with a stable gen_ai.conversation.id. Each prompt you send in the same conversation creates a new turn that shares that ID, and Traccia groups those turns into one session. In the CLI, resuming a conversation with copilot --resume continues the same session.
In Traccia, turn on Group by session on the Traces page to collapse a conversation into one row:
- Session row: total tokens, wall time, and estimated cost rolled up across all turns
- Turn rows: individual prompts expanded underneath
- Open: session detail page with every turn in order, plus GitHub Copilot and IDE or CLI badges
- Badges: turn count and tool retry count at a glance
A turn is marked as failed only when the agent turn itself errors. If a tool call fails inside a turn that otherwise succeeds, the error stays on that tool span and the turn shows Success with a tool retry badge.
One session per conversation
Understanding cost
GitHub bills Copilot through your plan, not per token. Traccia therefore labels Copilot costs as estimates:
| Label in Traccia | What it means |
|---|---|
| Copilot Estimate | What the same tokens would cost at the model provider's public API pricing, including cached-token rates. Not your GitHub bill. |
| Unpriced | The model has no public price in Traccia's rate table yet. Token counts are still shown. |
AI credits
copilot.ai_credits, so you can compare it with the API-equivalent estimate in the span details.Agent identity
By default every turn rolls up under one agent, GitHub Copilot, whether it came from VS Code or the CLI. Subagents never create separate agents.
To split teams or environments, set your own agent.id and env as resource attributes:
"github.copilot.chat.otel.resourceAttributes": { "agent.id": "copilot-backend", "agent.name": "copilot-backend", "env": "production"}export OTEL_RESOURCE_ATTRIBUTES="agent.id=copilot-backend,agent.name=copilot-backend,env=production"Roll out to your team
Give each team a Traccia workspace and an ingestion key scoped to that workspace so traces stay isolated, then distribute the settings above. If your organization manages Copilot's OpenTelemetry settings centrally, those managed settings replace each developer's personal ones, so configure the Traccia endpoint and key there.
Privacy
github.copilot.chat.otel.captureContent (Copilot Chat's own calls) or OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT (VS Code agent mode and the CLI) set to true, Copilot sends prompts, responses, and tool inputs and outputs, which can include source code. To send metadata only (models, tokens, timing, and tool names), set both to false, then quit and restart VS Code. Turning off only the setting leaves agent mode and the CLI capturing content. Traccia truncates very large values on ingest; in VS Code you can also cap them with github.copilot.chat.otel.maxAttributeSizeChars.Troubleshooting
| Symptom | What to check |
|---|---|
| No traces from VS Code | Confirm the settings are in User settings and that you reloaded the window. Make sure you are signed in to GitHub in VS Code. Check the time range filter in Traccia. |
| Only small one-call traces from VS Code, no agent turns | Those are Copilot Chat's background calls. Agent mode needs the environment variables from step 2, set before VS Code starts. Quit every VS Code window, then start it from the shell where you set them. |
| No traces at all, from VS Code or the CLI | If COPILOT_OTEL_FILE_EXPORTER_PATH is set in your environment, Copilot writes telemetry to that file instead of exporting it. Unset it. Also check that OTEL_EXPORTER_OTLP_ENDPOINT is not pointing somewhere else. |
| 401 Unauthorized | The key is missing or invalid. In VS Code settings the header value is Bearer tr_live_...; in the environment variable it is Authorization=Bearer%20tr_live_.... Regenerate the key in Settings if needed. |
| Tool retry badge on a turn | A tool failed mid-turn but the turn completed. Open the trace to see which tool errored. The turn outcome can still be Success. |
| Cost shows Unpriced | The model is not in Traccia's rate table yet. Tokens are still recorded; the estimate fills in once the model is priced. |
| Not sure what Copilot is sending | In VS Code, set github.copilot.chat.otel.exporterType to console, or set github.copilot.chat.otel.outfile to a file path, to inspect spans locally. In the CLI, set COPILOT_OTEL_FILE_EXPORTER_PATH for one run. Undo it afterwards, because both stop export to Traccia. |
Current limitations
- Copilot's metrics and log events are accepted and stored, but they do not have dedicated dashboards yet.
- Cost is an API-equivalent estimate, not your GitHub bill.
- The Copilot CLI does not send git repository or branch details.
Next Steps
© 2026 Traccia.