Claude Code Integration

Platform

Full 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

Traccia accepts Claude Code's OTLP payloads directly over HTTPS. You do not need to run Jaeger, SigNoz, or an OpenTelemetry Collector.

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)

~/.claude/settings.json
json
{
"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.

~/.claude/settings.json
json
{
"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:

bash
claude

Ask 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

A long Claude Code session with ten prompts produces ten traces and one session. Use sessions to answer "how much did this whole coding session cost?" instead of adding up traces manually.

Understanding cost

Traccia labels costs based on how Claude Code is routed:

BackendBilled in TracciaWhat you also see
Anthropic APIActual USD from Claude Code billing logsBadge: 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

Traccia shows peak context(largest single request — similar to Claude Code's /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

Claude Code log events — tool decisions, user prompts, API requests — feed Traccia's audit and governance pipeline. See Governance Hub for policy posture and export bundles.

Troubleshooting

SymptomWhat to check
No traces after a sessionExit 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 UnauthorizedRegenerate the API key in Settings. The header must be Authorization=Bearer tr_live_…
Tool retry badge on a sessionA 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 OllamaExpected. 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.