Claude Code Integration
PlatformFull observability for Claude Code — every interaction, tool call, and session, with no code changes and no OpenTelemetry Collector.
Claude Code already exports rich OpenTelemetry data — interactions, LLM requests, tool executions, token usage, and billing signals. Traccia ingests that data natively on the hosted platform. Point Claude Code at Traccia, run your session, and open the dashboard to see exactly what happened: which tools ran, how much context grew, what it cost, and how multi-turn conversations roll up into sessions.
Zero code changes
Configure once in ~/.claude/settings.json. No SDK, no wrapper, no changes to your repos.
Sessions built in
Every CC conversation gets a session.id. Traccia groups interactions automatically.
Tool-level visibility
See Bash, Read, Edit, and subagent runs with durations, retries, and failures.
Honest cost labels
Anthropic API billing when routed to Claude; reference tariffs when using Ollama or other backends.
No collector required
1Get a Traccia API key
Sign in to app.traccia.ai, open Settings → API Keys, and create an ingestion key. Copy the key — you will paste it into Claude Code's settings in the next step.
2Configure Claude Code
Add one of the following to ~/.claude/settings.json. Replace YOUR_TRACCIA_API_KEY with your key. Set env to match your environment (e.g. production, staging).
HTTP (protobuf)
{ "env": { "CLAUDE_CODE_ENABLE_TELEMETRY": "1", "OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf", "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT": "https://api.traccia.ai/v2/traces", "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT": "https://api.traccia.ai/v2/metrics", "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT": "https://api.traccia.ai/v2/logs", "OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Bearer YOUR_TRACCIA_API_KEY", "OTEL_SERVICE_NAME": "claude-code", "OTEL_RESOURCE_ATTRIBUTES": "agent.id=claude-code,agent.name=claude-code,env=production" }}gRPC
Claude Code's default OTLP transport. Uses a single endpoint for traces, metrics, and logs. For the general gRPC reference (all native OTel clients), see Platform OTLP Ingestion.
{ "env": { "CLAUDE_CODE_ENABLE_TELEMETRY": "1", "OTEL_EXPORTER_OTLP_PROTOCOL": "grpc", "OTEL_EXPORTER_OTLP_ENDPOINT": "https://api.traccia.ai:4317", "OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Bearer YOUR_TRACCIA_API_KEY", "OTEL_SERVICE_NAME": "claude-code", "OTEL_RESOURCE_ATTRIBUTES": "agent.id=claude-code,agent.name=claude-code,env=production" }}3Run Claude Code and open Traccia
Start a session as you normally would:
claudeAsk Claude Code to do real work — read files, run commands, iterate on a task. Telemetry exports every few seconds and flushes when you exit cleanly.
In Traccia, go to Traces, filter by agent claude-code, and click any trace to open the full timeline. Your first trace usually appears within seconds of completing a prompt.
Sessions
Claude Code assigns every conversation a stable session.id. Each time you send a new prompt in the same terminal session, Claude Code creates a new interaction (trace) that shares that session ID.
In Traccia, turn on Group by session on the Traces page to collapse a conversation into one row:
- Session row — total tokens, duration, billed cost, and CC reference cost rolled up across all interactions
- Interaction rows — individual prompts expanded underneath
- Open — session detail page with every interaction in chronological order
- Badges — interaction count and tool retry count at a glance
One session, many traces
Understanding cost
Traccia labels costs based on how Claude Code is routed:
| Backend | Billed in Traccia | What you also see |
|---|---|---|
| Anthropic API | Actual USD from Claude Code billing logs | Badge: Anthropic API |
| Ollama Cloud | $0 (free tier usage) | CC reference tariff — what the same tokens would cost on Anthropic, for comparison |
| Local Ollama | $0 (runs on your hardware) | CC reference tariff when available |
Peak context vs cumulative tokens
/context) separately from cumulative usage (sum of all API calls in the trace). A long session can show high cumulative tokens while peak context stays modest — both numbers are correct.Agent identity
Keep agent.id=claude-code in OTEL_RESOURCE_ATTRIBUTES so every session rolls up under one agent in the dashboard.
For teams running multiple CC profiles (e.g. different repos or environments), use distinct agent.id values like claude-code-backend and claude-code-frontend, and set env to match.
Roll out to your team
For organization-wide rollout, use Claude Code managed settings to inject the same env block for every developer. Pair each team with a Traccia workspace and ingestion key scoped to that workspace so traces stay isolated.
Governance
Troubleshooting
| Symptom | What to check |
|---|---|
| No traces after a session | Exit Claude Code cleanly (telemetry flushes on shutdown). Confirm your API key is valid and the Bearer prefix is present in OTEL_EXPORTER_OTLP_HEADERS. Check the time range filter in Traccia matches when you ran the session. |
| 401 Unauthorized | Regenerate the API key in Settings. The header must be Authorization=Bearer tr_live_… |
| Tool retry badge on a session | A tool failed mid-run but the interaction completed. Open the trace to see which tool errored — the session outcome can still be Success. |
| Cost shows $0 with Ollama | Expected. Look for the CC reference line below the billed amount — that is Claude Code's Anthropic-equivalent estimate, not your actual bill. |
Next Steps
© 2026 Traccia.