Claude Code and Codex usage (OpenTelemetry)
Claude Code and Codex can report their own usage with OpenTelemetry. Trakkwise receives it directly, with no collector in between, and shows it under Analytics → Coding assistants: for each tool and person, the sessions, prompts, tokens and estimated cost by model, lines changed, commits, pull requests and active time.
The agent and the browser extension see that these tools are installed and running; this adds what they did.
1. Create a telemetry token
In the console, Settings → Integrations → Claude Code and Codex → Create token. Copy it: it is shown once. A telemetry token can only send usage data; it can't read anything. Create one per fleet or MDM so you can revoke one without the others.
The page shows both settings below with your token and address filled in.
2. Claude Code
Add these env keys to the managed settings file on each developer's
computer, in the file your MDM already deploys if you have one:
- macOS:
/Library/Application Support/ClaudeCode/managed-settings.json - Windows:
C:\Program Files\ClaudeCode\managed-settings.json - Linux and WSL:
/etc/claude-code/managed-settings.json
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/json",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://<your ingest address>/v1/otlp",
"OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Bearer tt_..."
}
}
Set in managed settings, developers can't point the data elsewhere. Metrics
arrive about once a minute, and prompts as they happen. Leave
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE at its default (delta):
Trakkwise refuses cumulative metrics, and the response says so.
3. Codex
In each developer's ~/.codex/config.toml:
[otel]
log_user_prompt = false
[otel.exporter.otlp-http]
endpoint = "https://<your ingest address>/v1/otlp/v1/logs"
protocol = "json"
headers = { "Authorization" = "Bearer tt_..." }
Codex reports through log events. Trakkwise reads session starts, prompts (counted), token counts per response and the estimated cost per turn. The Codex extension in VS Code-style editors shows as Codex for IDEs.
What is kept, and what isn't
Trakkwise keeps one row per day, tool, person and model, with totals only. The person is the email the tool reports for its signed-in account; a tool that doesn't report one counts as "unknown". These are discarded when they arrive and never stored:
- prompt text, if a developer turned on prompt logging;
- assistant responses, tool input and output;
- file names, repository names, and session and conversation IDs.
Leave prompt and tool-detail logging off anyway (OTEL_LOG_USER_PROMPTS,
OTEL_LOG_TOOL_DETAILS, Codex's log_user_prompt): the text would still travel
over the network, and the firewall may refuse requests whose text looks like an
attack.
Cost is the tool's own estimate at list prices. For what you are actually billed, connect Anthropic or OpenAI under Settings → Integrations.
Troubleshooting
| Symptom | Fix |
|---|---|
| Nothing arrives from Claude Code | Start claude --debug-file /tmp/cc.log and look for [3P telemetry] errors. Check that the protocol is http/json; Trakkwise doesn't accept gRPC or protobuf (it answers 415 with that message) |
| 401 | The token is wrong or revoked: create a new one |
| Usage shows no person | The tool didn't report an email (for example, Claude Code with an API key rather than a signed-in account). The totals still count, under "unknown" |