GitHub Copilot

Connect GitHub Copilot to CloudZero to see each user's Copilot requests as they happen, alongside the rest of your cloud and AI spend. Copilot exports its own OpenTelemetry traces from Copilot CLI and from Copilot Chat in VS Code, so you send telemetry straight to CloudZero with nothing to install. Once connected, you can break Copilot usage down by the same Dimensions as your other costs, such as team, product, or repository.

This guide covers turning on Copilot's OpenTelemetry export and pointing it at the dedicated CloudZero route.

How it works

Copilot exports OpenTelemetry traces using the OpenTelemetry Protocol (OTLP) over HTTP. CloudZero counts each model call (Copilot's chat spans) once and skips the agent-level spans that repeat their totals. Each event records the model, token counts, timing, and the repository, branch, and commit Copilot reports. CloudZero estimates each call's cost from the AI units Copilot reports on it. Events appear on the Livestream tab of AI Signals.

This telemetry complements the GitHub connection, and the two answer different questions:

SourceWhat it gives you
GitHub connectionWhat GitHub bills you: Copilot seat costs and premium-request usage from GitHub's Enhanced Billing Platform
Copilot telemetry (this page)Each Copilot request as it happens, with model, tokens, estimated cost, and the repository it was made in

Connect both to see billed Copilot spend and the request-level activity behind it.

⚠️

Send Copilot telemetry to the dedicated /v2/telemetry/copilot route. The generic OpenTelemetry route does not read Copilot's AI-unit cost attributes and can count the same usage more than once. If you already send Copilot traces to /v2/telemetry/otel-genai, switch the endpoint to the one in Step 2.

ℹ️

This integration does not use the Create Connection flow in Settings > Connections. You connect it by creating a CloudZero API key and pointing Copilot's telemetry at CloudZero, as described below.

What you need

  • A CloudZero user with API key access
  • Permission to view AI Signals in CloudZero, to confirm data is arriving
  • GitHub Copilot CLI, or Copilot Chat in VS Code, in use by the team you are onboarding
  • Outbound HTTPS connectivity from every user's machine to telemetry.cloudzero.com on port 443

Step 1: Create a CloudZero API key

  1. In CloudZero, go to Settings > API Keys.
  2. Create a new API key.
  3. Under Scopes, choose Managed scopes and select Send AI Telemetry. CloudZero keeps the key's scopes current as new telemetry endpoints ship.
  4. Copy the key value and store it securely. You set it as an environment variable in Step 2. Treat it like any other secret.
ℹ️

Send AI Telemetry authorizes CloudZero's AI telemetry ingest endpoints. To grant it explicitly instead, choose Fixed scopes and select AI Telemetry (all sources) (ai-telemetry-ingest:ingest-ai-telemetry). A fixed key does not pick up telemetry endpoints added later. If a request returns 401, the key is invalid or has neither scope. See Fixed and managed scopes.

Step 2: Turn on Copilot telemetry and point it at CloudZero

Copilot CLI and Copilot Chat in VS Code turn on telemetry differently. Both send to the same CloudZero endpoint:

https://telemetry.cloudzero.com/v2/telemetry/copilot

CloudZero accepts this endpoint with or without /v1/traces appended, so it works however your Copilot version builds the trace URL. Use https://: Copilot CLI turns off export for an http:// endpoint rather than send data unencrypted.

Option A: Copilot CLI

Copilot CLI reads the standard OpenTelemetry variables, which every OpenTelemetry-instrumented process also reads. Exporting them in a shell profile would send other processes' traces, with your CloudZero key, to the Copilot route, or send the key to another vendor's endpoint. Set them only for Copilot CLI instead, for example with a shell function in your shell profile:

copilot() {
  COPILOT_OTEL_ENABLED=true \
  OTEL_EXPORTER_OTLP_ENDPOINT=https://telemetry.cloudzero.com/v2/telemetry/copilot \
  OTEL_EXPORTER_OTLP_HEADERS=Authorization=<your-cloudzero-api-key> \
  command copilot "$@"
}
VariableValueWhy
COPILOT_OTEL_ENABLEDtrueTurns on Copilot's OpenTelemetry export. Setting the endpoint also turns it on, so this flag makes the intent explicit.
OTEL_EXPORTER_OTLP_ENDPOINThttps://telemetry.cloudzero.com/v2/telemetry/copilotThe CloudZero route for Copilot.
OTEL_EXPORTER_OTLP_HEADERSAuthorization=<your-cloudzero-api-key>The key from Step 1. CloudZero also accepts the key with a Bearer prefix. Store it as a secret.

Copilot CLI exports over OTLP/HTTP using http/json by default. CloudZero accepts http/json and http/protobuf, so you do not need to set a protocol. For the full list of Copilot CLI telemetry variables, see GitHub's OpenTelemetry monitoring reference.

Option B: Copilot Chat in VS Code

  1. In VS Code, open Settings, search for copilot otel, and set these values:
SettingValue
github.copilot.chat.otel.enabledtrue
github.copilot.chat.otel.exporterTypeotlp-http
github.copilot.chat.otel.otlpEndpointhttps://telemetry.cloudzero.com/v2/telemetry/copilot
  1. Set the OTEL_EXPORTER_OTLP_HEADERS environment variable to Authorization=<your-cloudzero-api-key> in the environment VS Code starts from. VS Code's user settings have no field for exporter headers, so the key must come from this variable. Every process VS Code starts, including integrated terminals, tasks, and debug targets, inherits it. To keep the key out of those processes, deliver it through enterprise managed settings instead (Step 3).
  2. Restart VS Code so it picks up the settings and the variable.

Keep the exporter type at otlp-http. VS Code also offers otlp-grpc, which CloudZero does not accept. Environment variables take precedence over VS Code settings, so an OTEL_EXPORTER_OTLP_ENDPOINT set elsewhere on the machine overrides the endpoint above. For every Copilot Chat telemetry setting, see the VS Code guide to monitoring agent usage with OpenTelemetry.

Step 3: Roll out org-wide (optional)

Once you have confirmed data is flowing from one machine (Step 4), configure export centrally so every user reports to CloudZero with nothing to set themselves. Administrators can set the OTLP endpoint, protocol, and exporter headers for Copilot through:

Use the same values as Step 2: the CloudZero endpoint, an HTTP protocol, and an Authorization header with your API key.

Step 4: Send traffic and verify

  1. Apply the configuration from Step 2 or Step 3 on a machine where Copilot is in use.
  2. Use Copilot CLI or Copilot Chat for a few requests.
  3. In CloudZero, open AI Signals and select the Livestream tab.

Copilot events appear on the Livestream tab within seconds of usage.

Smoke-test your API key

Before you wait on real usage, you can confirm your key works. An empty POST should return HTTP 202:

curl -i -X POST \
  "https://telemetry.cloudzero.com/v2/telemetry/copilot" \
  -H "Authorization: <your-cloudzero-api-key>" \
  -H "Content-Type: application/json" \
  --data '{}'

Expected response:

HTTP/2 202
content-type: application/json

{"status":"accepted"}

A 202 confirms the key is valid and has the right scope. A 401 means the key is invalid or revoked, or lacks both the Send AI Telemetry managed scope and the AI Telemetry (all sources) (ai-telemetry-ingest:ingest-ai-telemetry) fixed scope, so re-check Step 1.

⚠️

A 202 proves authentication, not routing. CloudZero also returns 202 for an empty body or a mistyped route under /v2/telemetry/, and drops data it cannot process. The Livestream tab is what proves Copilot's real traces are being ingested. If the smoke test passes but nothing appears after real usage, work through Troubleshooting.

What to expect

After you connect, CloudZero records each Copilot model call as it arrives. Copilot events appear on the AI Signals Livestream tab within seconds of usage, showing model, token counts, timing, and estimated cost. Each event also carries the repository, branch, and commit Copilot reports, so you can see which codebases drive Copilot usage.

CloudZero calculates cost estimates from the AI units Copilot reports per call. For the amounts GitHub bills you, including seat costs, connect GitHub.

From there, you can organize Copilot usage by team or product using Dimensions, track trends in Analytics Dashboards, or ask questions in the AI Hub.

Attribute usage to people and teams

Copilot sends a pseudonymous user ID (enduser.pseudo.id) with each request, and CloudZero records it, so you can compare usage across users without names. To attribute usage further, add OpenTelemetry resource attributes through the OTEL_RESOURCE_ATTRIBUTES environment variable:

export [email protected],cz.context.team=platform

CloudZero reads user.email, user.id, and user.name from the span or the resource. cz.context.<name> attributes, such as cz.context.team, attach business context to every request. For the names with a defined meaning, see Business enrichment.

Data privacy

Copilot does not capture prompt, response, or tool content in its telemetry unless you turn content capture on. It is off by default in Copilot CLI and in VS Code. Leave it off for this integration: CloudZero's cost and usage events do not need it.

CloudZero reads these attributes from each Copilot request:

  • Model, token counts, timing, and AI units
  • Repository, branch, and commit
  • Session ID and Copilot's pseudonymous user ID
  • Copilot's request, turn, and interaction IDs and its per-request billing multiplier
  • Host name, when Copilot sends it
  • user.email, user.id, and user.name, when you send them
  • Any cz.context.* attributes you add

Choose between telemetry and the AI Collector

The CloudZero AI Collector also captures GitHub Copilot CLI usage on Copilot Individual and Business seats, along with several other AI tools, from each Mac it is installed on. Copilot's own telemetry needs nothing installed, works on any operating system, and covers Copilot Chat in VS Code. Choose the Collector when IT already deploys it to your Macs and you want one agent for every AI tool. Use one path per tool on each machine. Usage a tool reports both ways is counted twice.

To label Copilot CLI turns with the kind of work and the repository, branch, pull request, and work item behind them, send Copilot CLI telemetry through the AI Data Plane instead, which runs in your own Kubernetes cluster. That path turns on Copilot CLI's content capture, so prompts reach the AI Data Plane in your cluster. See AI Data Plane client telemetry.

Troubleshooting

If data is not appearing on the AI Signals Livestream tab 5 minutes after confirmed Copilot usage, work through these in order.

  1. Export is not turned on. For Copilot CLI, set COPILOT_OTEL_ENABLED=true or OTEL_EXPORTER_OTLP_ENDPOINT. For VS Code, set github.copilot.chat.otel.enabled to true and restart VS Code. Re-check Step 2.
  2. Invalid key or missing scope (401). The key is mistyped, revoked, or lacks the Send AI Telemetry managed scope and the AI Telemetry (all sources) (ai-telemetry-ingest:ingest-ai-telemetry) fixed scope. Run the smoke test and re-check Step 1.
  3. VS Code did not get the API key. VS Code reads the key only from the OTEL_EXPORTER_OTLP_HEADERS environment variable. If you set it after VS Code started, or in a shell VS Code does not inherit from, restart VS Code from an environment that has it.
  4. Wrong or mistyped route. The endpoint must be https://telemetry.cloudzero.com/v2/telemetry/copilot. CloudZero returns 202 for unrecognized routes under /v2/telemetry/, so a typo produces no error.
  5. gRPC selected in VS Code. CloudZero accepts OTLP over HTTP only. Set the exporter type to otlp-http. Also unset COPILOT_OTEL_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL if either is set to grpc, because either one switches VS Code to gRPC.
  6. Endpoint uses http://. Copilot CLI turns off export for an unencrypted endpoint and writes only a warning to its process log. Use https://.
ℹ️

Have questions or feedback? Reach out to your account manager.


Did this page help you?