# Telemetry



# Telemetry [#telemetry]

Cluster Build can send content-free traces, metrics, and completion logs to an
OpenTelemetry collector you run, over OTLP HTTP/protobuf. Export is **disabled
by default**.

## Enable export [#enable-export]

Add a `[telemetry]` table to your user config, `~/.cluster/config.toml`:

```toml
[telemetry]
enabled = true
endpoint = "https://collector.example/otlp"
```

`endpoint` is the collector's base URL; Build appends `/v1/traces`,
`/v1/metrics`, and `/v1/logs`. Use HTTPS. Plain HTTP works for loopback
collectors such as `http://127.0.0.1:4318`; for other HTTP collectors on a
private network, also set `allow_insecure_http = true`, which sends
measurements and collector credentials unencrypted. URLs with credentials, a
query string, or a fragment are rejected, and redirects aren't followed.

Supply collector credentials through
[`OTEL_EXPORTER_OTLP_HEADERS`](/docs/build/config/environment-variables#telemetry)
or its per-signal variants, not in the config file. Environment variables alone
never turn export on.

Restart the process that runs your sessions after changing the settings or
credentials, including a running [Build daemon](/docs/build/interactive#the-build-daemon).
The credentials must be in that process's environment. Sessions run by the
Cluster Desktop app don't export telemetry.

`cluster config show` reports `telemetry_enabled`,
`telemetry_allow_insecure_http`, and `telemetry_endpoint_configured` without
printing the endpoint. These reflect your configuration, not whether the
collector is reachable.

## What's exported [#whats-exported]

Every signal carries the resource attributes `service.name = build-cli`,
`service.version` (the CLI version), and `build.telemetry.schema.version`
(currently `3`). Spans nest like this:

```text
build.turn
  build.model.request
    build.model.attempt
  build.tool.call
```

### Turns [#turns]

| Signal    | Name                   | Unit     |
| --------- | ---------------------- | -------- |
| Span      | `build.turn`           |          |
| Counter   | `build.turn.count`     | `{turn}` |
| Histogram | `build.turn.duration`  | `s`      |
| Log event | `build.turn.completed` |          |

Each carries `build.turn.outcome`: `success`, `cancelled`, `failed`, or
`interrupted`. The completion log event has no body and is correlated with the
turn's trace.

### Model requests [#model-requests]

A model request is one foreground call to the model, including any HTTP
retries and consuming the streamed response. Each HTTP send within it is an
attempt. A model call after tool execution starts a new request. Background
work such as title generation and memory isn't measured.

| Metric                         | Unit        | Meaning                                                |
| ------------------------------ | ----------- | ------------------------------------------------------ |
| `build.model.request.count`    | `{request}` | Model requests, including failed and cancelled ones    |
| `build.model.request.duration` | `s`         | Full request duration                                  |
| `build.model.attempt.count`    | `{attempt}` | HTTP sends                                             |
| `build.model.attempt.duration` | `s`         | Send until response headers or transport failure       |
| `build.model.first_output`     | `s`         | Time to the first text, reasoning, or tool-call output |
| `build.model.first_text`       | `s`         | Time to the first assistant text                       |
| `build.model.tokens`           | `{token}`   | Provider-reported token usage                          |

Attributes:

* `build.model.provider`: `cluster` or `ollama`.
* `build.model.outcome`: `success`, `failed`, `cancelled`, or `interrupted`.
* `build.model.error`: `none`, `auth`, `rate_limit`, `server`, `http`,
  `transport`, `timeout`, `stream`, `input_limit`, or `other`.
* On attempts, `build.model.attempt.kind` (`initial` or `retry`) and
  `http.response.status_class` (`1xx` through `5xx`, `other`, or `none`).
* On `build.model.tokens`, `build.model.token.kind`: `input`, `output`,
  `cache_read`, or `cache_creation`.

First-output timings measure when the runtime receives output, not terminal
rendering, and are omitted when no output arrives. Token usage is recorded
once per request from the provider's latest usage report; kinds the provider
doesn't report are omitted. Cost isn't exported.

### Tool calls [#tool-calls]

Each tool call emits a `build.tool.call` span under its turn, covering both
waiting and execution.

| Metric                | Unit     | Meaning                                                          |
| --------------------- | -------- | ---------------------------------------------------------------- |
| `build.tool.count`    | `{call}` | Finished tool calls, including denied and cancelled ones         |
| `build.tool.wait`     | `s`      | Time before the tool starts, including waiting for your approval |
| `build.tool.duration` | `s`      | Execution time                                                   |

A call that's denied or cancelled before it starts records waiting time but
no execution time.

Attributes:

* `build.tool.surface`: `generic`, `browser`, or `computer`.
* `build.tool.dispatch`: `native`, `mcp`, or `unresolved`.
* `build.tool.outcome`: `success`, `failed`, `denied`, `cancelled`,
  `panicked`, or `interrupted`.

A failed tool call doesn't by itself fail the turn.

## Privacy [#privacy]

Exports never include prompts, responses, reasoning, model names, tool or MCP
server names, tool arguments and results, error messages, workspace paths,
user identifiers, or credentials. Local diagnostic logs aren't forwarded to
the collector.

## Export failures [#export-failures]

Invalid telemetry settings turn export off with a warning in the local log.
Export failures never change command results or exit codes; they're logged to
`~/.cluster/logs/` (and stderr for headless runs) without collector responses
or credentials.

Export is best effort. Build doesn't retry failed exports or queue
measurements on disk, so a collector outage or a killed process can lose
measurements.
