> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agent.golf/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub Copilot

> Send the OpenTelemetry data of GitHub Copilot in the CLI, the Copilot app, and VS Code to Cloud Uplink or a Self-Hosted Uplink instance.

GitHub Copilot sends OpenTelemetry data in two shapes:

* The GitHub Copilot CLI, the Copilot app, and the VS Code Agent Host share one runtime and send traces and metrics with `service.name=github-copilot`. [Settings](#settings) and the sections after it apply to them. `agentgolf harness setup copilot` configures this shape only. The `agentgolf` CLI and its setup command run on Linux and macOS.
* The local agent of the GitHub Copilot Chat extension in VS Code sends `service.name=copilot-chat`. Set it up by hand. See [VS Code local agent](#vs-code-local-agent).

A Self-Hosted Uplink instance records GitHub Copilot sessions from Uplink 0.1.43.

## Settings

The **Harness Setup** card on **Settings > Uplink > Publishing Keys** shows these settings, and `agentgolf harness setup copilot` writes them. See [Set up with the CLI](https://docs.agent.golf/harnesses/overview.md#set-up-with-the-cli).

Copilot settings have no block for environment variables. So the setup has two parts:

* Files in `$COPILOT_HOME`, or in `~/.copilot` when `COPILOT_HOME` is unset. They hold the publishing key and the content setting. The command writes them.
* Environment variables that turn on the export. The command prints them and writes no shell profile. Add them to the profile of the shell that starts Copilot. They hold no secret.

To copy the settings by hand, replace:

* `<endpoint>` with `https://uplink.agent.golf` for Cloud Uplink, or with the listener of your Self-Hosted Uplink instance, for example `http://127.0.0.1:4318`.
* `<publishing-key>` with your personal publishing key. See [Publishing keys](https://docs.agent.golf/harnesses/overview.md#publishing-keys).
* `<copilot-home>` with the absolute path of `$COPILOT_HOME`, for example `/home/grace/.copilot`.

### 1. The publishing-key file

Put the header in `<copilot-home>/agentgolf-otlp-headers.json`, and let only your user read the file (`chmod 600`):

```json theme={null}
{ "x-agentgolf-publishing-key": "<publishing-key>" }
```

### 2. The user settings

Add the `telemetry` keys to `<copilot-home>/settings.json`, and keep the file's other settings:

```json theme={null}
{
  "telemetry": {
    "captureContent": true,
    "headersProvider": {
      "path": "cat",
      "args": ["<copilot-home>/agentgolf-otlp-headers.json"]
    }
  }
}
```

* `headersProvider` runs `cat` on the key file, and Copilot sends its output as the OTLP headers. Copilot reads this setting only from the user settings and the managed settings. A repository `.github/copilot/settings.json` cannot set it.
* `captureContent` adds message and tool content. See [Session content](#session-content).
* Copilot accepts comments and trailing commas in `settings.json`, but `agentgolf harness setup copilot` reads only strict JSON and refuses such a file. Remove the comments and trailing commas, or change a setting with `copilot config`: Copilot then writes the file again without them.

### 3. The environment variables

Export the variables in the shell that starts Copilot:

```bash theme={null}
export COPILOT_OTEL_ENABLED='true'
export OTEL_EXPORTER_OTLP_ENDPOINT='<endpoint>'
export OTEL_EXPORTER_OTLP_PROTOCOL='http/protobuf'
export OTEL_SERVICE_NAME='github-copilot'
copilot
```

| Variable | Value | Purpose |
| - | - | - |
| `COPILOT_OTEL_ENABLED` | `true` | Turns on the export. |
| `OTEL_EXPORTER_OTLP_ENDPOINT` | `<endpoint>` | The base URL of the uplink instance, without `/v1/<signal>`. |
| `OTEL_EXPORTER_OTLP_PROTOCOL` | `http/protobuf` | The protocol that Uplink accepts. |
| `OTEL_SERVICE_NAME` | `github-copilot` | The default Copilot service name. See the note below. |

* Set `OTEL_EXPORTER_OTLP_PROTOCOL`. Copilot uses `http/json` by default, and Uplink refuses JSON with `415`.
* Do not set `grpc`. The Copilot CLI has no gRPC exporter: it ignores `grpc`, sends `http/json`, and Uplink refuses it with `415`. The process log then has the warning `OTEL_EXPORTER_OTLP_PROTOCOL=grpc ignored`.
* `github-copilot` is the default Copilot service name. Set it anyway: a shell that exports `OTEL_SERVICE_NAME` for another tool changes the service name of Copilot. Then Agent Golf can record the session under the wrong harness.
* A `service.name` in `OTEL_RESOURCE_ATTRIBUTES` wins over `OTEL_SERVICE_NAME`. Remove it from the environment of `copilot`, or unset `OTEL_RESOURCE_ATTRIBUTES`.
* Start the Copilot app, or VS Code for Agent Host sessions, from a shell that has these variables. On macOS, VS Code that starts from the Dock does not read the shell environment.

## Team rollout

An admin can roll out the export settings in the Copilot managed settings. Each developer then adds only their personal publishing key. See [Roll out to a team](https://docs.agent.golf/harnesses/overview.md#roll-out-to-a-team).

`agentgolf harness managed-settings copilot` prints the managed settings. Add `--endpoint <url>` for a Self-Hosted Uplink instance. See [`agentgolf harness managed-settings`](https://docs.agent.golf/cli/commands#agentgolf-harness-managed-settings).

```json theme={null}
{
  "telemetry": {
    "enabled": true,
    "endpoint": "<endpoint>",
    "protocol": "http/protobuf",
    "captureContent": true,
    "serviceName": "github-copilot"
  }
}
```

Install the document in one of these places:

* Linux: `/etc/github-copilot/managed-settings.json`.
* macOS: `/Library/Application Support/GitHubCopilot/managed-settings.json`.
* Or the `telemetry` object of the server-managed `managed-settings.json`.

The file must be owned by root, must not be world-writable, and must not be a symbolic link. For example, on Linux:

```bash theme={null}
agentgolf harness managed-settings copilot > managed-settings.json \
  && sudo install -D -m 0644 managed-settings.json /etc/github-copilot/managed-settings.json
```

Then each developer runs `agentgolf harness setup --all`, or `agentgolf harness setup --all --endpoint <url>` with the same URL for a Self-Hosted Uplink instance. It writes the publishing-key file and the user settings in `<copilot-home>`. Copilot uses the managed `telemetry` values in place of the environment variables, so the user needs no shell variables. The `export` lines that the command prints are then not necessary.

* Never set `headers` or `headersProvider` in the managed settings, also not `headersProvider: false`. A managed `headers` or `headersProvider` wins over the user's `headersProvider`, and a managed `false` turns off the user's helper. Each of them hides the personal publishing key of each user.
* When more than one managed source sets `telemetry`, the source with the highest precedence supplies the complete `telemetry` object. If your organization already has a managed `telemetry` object, merge these keys into it.

## Session content

By default, Copilot sends no message content, tool arguments, or tool results. `telemetry.captureContent` adds them. The settings above turn it on. Remove it where your policy does not allow the uplink instance to receive that content.

| Content capture | Session data |
| - | - |
| Off | Models, token counts, timings, tool names, tool outcomes, and shell exit codes. MCP server names arrive as hashes. |
| On | Also the prompts, the responses, the system instructions, the tool arguments, and the tool results. |

The environment variable `OTEL_INSTRUMENTATION_GENAI_CAPTURE_CONTENT=SPAN_ONLY`, and the older `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT`, also turn on content capture. To keep content off, make sure that the shell that starts Copilot does not set them.

With content capture off, Agent Golf links fewer sessions to pull requests automatically. See [Session content](https://docs.agent.golf/harnesses/overview.md#session-content).

## TLS with a private CA

If your Self-Hosted Uplink instance's certificate comes from a private CA, point Copilot at the CA bundle:

```bash theme={null}
export OTEL_EXPORTER_OTLP_CERTIFICATE=/etc/uplink/ca.pem
```

`NODE_EXTRA_CA_CERTS` has no effect on the Copilot export.

> [!WARNING]
>
> Set `OTEL_EXPORTER_OTLP_CERTIFICATE`, or a client certificate variable, only with an `https://` endpoint. With an
> `http://` endpoint, Copilot turns off the export and shows no error. It writes a warning only in its process log.

## Known limits

* `copilot --acp` sends no OpenTelemetry data. Sessions in this mode do not show in Agent Golf.
* A session that ends before its first model request sends no data.
* With an `http://` endpoint, Copilot writes `Dynamic OpenTelemetry headers will be transmitted over cleartext HTTP` in its process log, because the publishing key crosses the network in plain text. The export continues. For a Self-Hosted Uplink instance on loopback, you can ignore this warning.

## Verify the setup

* Start `copilot` and send a prompt. Then do the checks in [Verify the setup](https://docs.agent.golf/harnesses/overview.md#verify-the-setup).
* If Uplink receives no requests, read the newest process log in `<copilot-home>/logs`. It has the line `OpenTelemetry enabled: exporter=otlp-http` when the export is on. The warning `OTel policy build failed closed` means that a TLS variable is set with an `http://` endpoint.
* If Uplink refuses the requests with `415`, set `OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf`.
* If Uplink receives requests but no session shows, confirm that `OTEL_SERVICE_NAME` is `github-copilot` in the environment of Copilot, and that `OTEL_RESOURCE_ATTRIBUTES` holds no `service.name`.

## VS Code local agent

The GitHub Copilot Chat extension (`GitHub.copilot-chat`) runs the local agent of VS Code. It exports traces, metrics, and logs with `service.name=copilot-chat`. The facts in this section come from extension version 0.44.2.

A chat session that uses the Agent Host (VS Code setting `chat.defaultToCopilotHarness`) sends the CLI shape (`github-copilot`) instead. A Copilot CLI session that you start in the VS Code terminal also sends the CLI shape. For those sessions, use the CLI [Settings](#settings).

### VS Code settings

`agentgolf harness setup copilot` does not configure VS Code. Replace:

* `<endpoint>` with `https://uplink.agent.golf` for Cloud Uplink, or with the gRPC listener of your Self-Hosted Uplink instance, for example `http://127.0.0.1:4317`. A Self-Hosted Uplink instance opens the gRPC listener only when `OTLP_GRPC_PORT` is set. See [Network](https://docs.agent.golf/uplink/network.md).
* `<publishing-key>` with your personal publishing key. See [Publishing keys](https://docs.agent.golf/harnesses/overview.md#publishing-keys).

Add these keys to the VS Code user `settings.json`:

```json theme={null}
{
  "github.copilot.chat.otel.enabled": true,
  "github.copilot.chat.otel.exporterType": "otlp-grpc",
  "github.copilot.chat.otel.otlpEndpoint": "<endpoint>",
  "github.copilot.chat.otel.captureContent": true
}
```

| Setting | Default | Purpose |
| - | - | - |
| `github.copilot.chat.otel.enabled` | `false` | Turns on the export. `COPILOT_OTEL_ENABLED` wins over it. |
| `github.copilot.chat.otel.exporterType` | `otlp-http` | `otlp-http`, `otlp-grpc`, `console`, or `file`. Uplink needs `otlp-grpc`. |
| `github.copilot.chat.otel.otlpEndpoint` | `http://localhost:4318` | The gRPC endpoint of the uplink instance. `OTEL_EXPORTER_OTLP_ENDPOINT` wins over it. |
| `github.copilot.chat.otel.captureContent` | `false` | Adds more content. `COPILOT_OTEL_CAPTURE_CONTENT` wins over it. See [VS Code session content](#vs-code-session-content). |
| `github.copilot.chat.otel.outfile` | empty | Writes JSON lines to this file instead. It sends nothing to Uplink, so leave it empty. |

The extension has no setting for headers. It reads the publishing key only from `OTEL_EXPORTER_OTLP_HEADERS` in the environment of the VS Code process. Start VS Code with `code` from a shell that has the variable:

```bash theme={null}
export OTEL_EXPORTER_OTLP_HEADERS='x-agentgolf-publishing-key=<publishing-key>'
code
```

* On macOS, VS Code that starts from the Dock does not read the shell environment, so it sends no key.
* Reload the VS Code window after you change these settings.
* Keep the default service name `copilot-chat`. Do not set `OTEL_SERVICE_NAME` in the shell that starts `code`.
* Do not set `OTEL_EXPORTER_OTLP_COMPRESSION`. The extension sends uncompressed requests by default, and Uplink refuses a compressed request with gRPC status `12` (`UNIMPLEMENTED`).

> [!WARNING]
>
> The `otlp-http` exporter of the extension sends OTLP as JSON, and Uplink refuses JSON with `415`. Use `otlp-grpc`. An
> uplink instance before Uplink 0.1.43 has no gRPC listener and cannot receive the VS Code export. Upgrade the uplink
> instance, or put an OpenTelemetry Collector between VS Code and the uplink instance: point `otlpEndpoint` at the
> collector, and let the collector send `http/protobuf` to the uplink instance. See [A collector between the harness and
> Uplink](https://docs.agent.golf/harnesses/overview.md#a-collector-between-the-harness-and-uplink).

### VS Code session content

VS Code sends the prompts, the responses, the tool arguments, and the tool results for every value of `captureContent`. `captureContent: false` does not stop VS Code from sending prompt and tool content. The setting adds only the content of the inference log record and of the chat spans of BYOK models. No record shows the value of the setting. Agent Golf keeps this content like other session content. See [Session content](https://docs.agent.golf/harnesses/overview.md#session-content).

The extension cuts each content value at 64,000 characters.

### VS Code agents and tools

The local agent uses these tools: `create_file`, `replace_string_in_file`, `multi_replace_string_in_file`, `insert_edit_into_file`, `edit_notebook_file`, `apply_patch`, `read_file`, `grep_search`, and `run_in_terminal`.

The Claude agent of the extension sends its tool calls under `copilot-chat` too, with the Claude Code tool names: `Edit`, `MultiEdit`, `Write`, `NotebookEdit`, `Read`, `Grep`, `Glob`, and `Bash`. Agent Golf records them as GitHub Copilot tool calls. The Claude agent starts Claude Code with the environment of VS Code. When that environment turns on Claude Code telemetry, Claude Code also sends its own records, and Agent Golf records them as a Claude Code session. See [Claude Code](https://docs.agent.golf/harnesses/claude-code.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.