# Copilot CLI integration with Coralogix

GitHub Copilot CLI ships with built-in OpenTelemetry support, which means you can send its full telemetry — token usage, premium request consumption, model calls, tool invocations, and per-turn agent activity — to Coralogix. Once connected, every Copilot CLI session in your organization streams live data to a dedicated dashboard, giving you cost visibility, usage patterns, and per-user activity in one place.

## Supported environments

- Copilot CLI 1.0.41 or newer. Older versions emit a different attribute set.
- OS: macOS, Linux (\*nix)

## What you need

- A Coralogix account with a **Send-Your-Data [API key](https://coralogix.com/docs/user-guides/account-management/api-keys/send-your-data-api-key/index.md)**. In Coralogix, navigate to **Settings**, then **API Keys**.
- Your Coralogix OTLP endpoint: `ingress.[[DOMAIN_VALUE]]:443`. Use the domain selector at the top of this page to select your region.
- A local OpenTelemetry Collector (`otelcol-contrib`). See [Why a collector is required](#why-a-collector-is-required) below.
- Copilot CLI installed on your machine.

## Why a collector is required

Unlike Claude Code or Gemini CLI, Copilot CLI cannot push telemetry directly to Coralogix today. Its exporter emits OTLP/JSON, and Coralogix's gRPC ingress accepts OTLP/protobuf. You run a local OpenTelemetry Collector in front of the agent to convert the protocol.

## Set up

### Install Copilot CLI

```bash
npm install -g @github/copilot
copilot --version
```

The first time you run `copilot`, it walks you through GitHub authentication. Complete that step before continuing.

### Install the OpenTelemetry Collector

You need the **contrib** distribution because it includes the `deltatocumulative` processor.

**macOS:**

```bash
brew install opentelemetry-collector-contrib
```

**Linux:** download the `otelcol-contrib_<version>_linux_amd64.tar.gz` binary from the [OpenTelemetry Collector releases](https://github.com/open-telemetry/opentelemetry-collector-releases/releases) page and extract `otelcol-contrib` to your `PATH`.

### Configure the collector

Save the following to `~/.config/otelcol-coralogix.yaml`:

```yaml
receivers:
  otlp:
    protocols:
      http:
        endpoint: 127.0.0.1:14318
processors:
  batch:
    timeout: 1s
  deltatocumulative:
    max_streams: 1000
    max_stale: 5m
exporters:
  otlphttp/coralogix:
    endpoint: https://ingress.[[DOMAIN_VALUE]]:443
    encoding: proto
    headers:
      Authorization: "Bearer <YOUR_CX_API_KEY>"
      CX-Application-Name: "copilot-cli"
      CX-Subsystem-Name: "<TEAM_NAME>"
service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [otlphttp/coralogix]
    metrics:
      receivers: [otlp]
      processors: [deltatocumulative, batch]
      exporters: [otlphttp/coralogix]
```

Replace the placeholders with your Coralogix region, API key, and team name.

### Start the collector

```bash
nohup otelcol-contrib --config ~/.config/otelcol-coralogix.yaml > /tmp/otelcol.log 2>&1 &
echo $! > /tmp/otelcol.pid
```

Verify the collector started cleanly:

```bash
tail -5 /tmp/otelcol.log
# expect: "Everything is ready. Begin running and processing data."
```

To stop the collector later:

```bash
kill $(cat /tmp/otelcol.pid)
```

### Point Copilot CLI at the collector

In the shell where you run `copilot`:

```bash
export OTEL_EXPORTER_OTLP_ENDPOINT='http://127.0.0.1:14318'
export OTEL_SERVICE_NAME='github-copilot'
export OTEL_RESOURCE_ATTRIBUTES='cx.application.name=copilot-cli,cx.subsystem.name=<TEAM_NAME>'
```

Run Copilot CLI:

```bash
copilot
```

Copilot CLI sessions now stream telemetry to Coralogix.

### Make it permanent

Add the three `export` lines to `~/.zshrc` or `~/.bashrc` so every new shell exports them automatically.

## Application name and subsystem

Coralogix organizes incoming telemetry by two resource attributes: **Application name** and **Subsystem**. For Copilot CLI, we recommend:

| Attribute             | Recommended value                                              | Why                                                                 |
| --------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------- |
| `cx.application.name` | `copilot-cli`                                                  | Lets you filter dashboards and queries by Copilot CLI specifically. |
| `cx.subsystem.name`   | The team name — for example, `team1`, `enterprise`, `data-eng` | Lets you filter by team and compare usage across teams.             |

These values are set both as `OTEL_RESOURCE_ATTRIBUTES` on Copilot CLI **and** as `CX-Application-Name` and `CX-Subsystem-Name` headers on the collector. The collector's headers are authoritative — keep them in sync with what you set on the agent so spans group correctly.

With this convention in place, the AI Center Code Agents dashboard for Copilot CLI can be filtered by team from a single dropdown.

## View in AI Center

Once your Copilot CLI sessions are streaming telemetry, navigate to **AI Center**, then **Code Agents**, then **Copilot CLI** to see the dedicated dashboard. The **Application/Subsystem** dropdown lists every `<application> – <subsystem>` pair you configured (for example, `copilot-cli – team1`, `copilot-cli – team2`), so you can slice premium request usage, sessions, token data, and tool calls by team.

## Identify the user

Copilot CLI does not emit `user.email`. It emits `enduser.pseudo.id` — an anonymous SHA-256 hash, one per CLI installation — on `invoke_agent` spans only. Child `chat` and `execute_tool` spans do not carry it. Per-user queries should always target `invoke_agent`.

## Telemetry reference

The AI Center Code Agents dashboard surfaces the most common cost, usage, and activity signals out of the box. To explore every span, metric, and span event that GitHub Copilot CLI emits — and use those signals as the basis for your own Custom Dashboards or alerts — see the [GitHub Copilot CLI monitoring reference](https://code.visualstudio.com/docs/copilot/guides/monitoring-agents).

Copilot CLI does not emit standalone log records. The information that would normally appear in logs is attached to spans as span events, so the span-event stream is the right place to look for per-turn agent activity.

## Next steps

Once your integration is set up, explore [Code agents observability](https://coralogix.com/docs/user-guides/ai/code-agents/index.md) to monitor token usage, premium requests, tool calls, and session data across all your coding agents.
