Claude Code
Send Claude Code events, metrics and traces directly to Parseable through OpenTelemetry
Claude Code exports usage events, metrics and beta traces through OpenTelemetry. Send each signal directly to a separate Parseable dataset to inspect sessions, model requests, token use, tool activity, cost, latency and errors.
Claude Code
|-- logs ----> Parseable: claudecode-logs
|-- metrics --> Parseable: claudecode-metrics
+-- traces ---> Parseable: claudecode-traces (optional beta)Anthropic treats metrics and events as stable telemetry signals. Enhanced telemetry remains in beta and enables distributed traces. See Monitoring Claude Code usage for the current schema and version requirements.
Prerequisites
- Claude Code installed and authenticated
- A Parseable instance reachable from the developer machine
- A Parseable API key with ingest access
Enable Claude Code telemetry
Set separate OTLP endpoints and headers for logs and metrics before starting Claude Code:
export PARSEABLE_URL="https://<your-parseable-host>:8000"
export PARSEABLE_API_KEY="<parseable-api-key>"
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_LOGS_EXPORTER=otlp
export OTEL_METRICS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/json
export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT="${PARSEABLE_URL}/v1/logs"
export OTEL_EXPORTER_OTLP_LOGS_HEADERS="X-P-API-Key=${PARSEABLE_API_KEY},X-P-Stream=claudecode-logs,X-P-Log-Source=otel-logs"
export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=http/json
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT="${PARSEABLE_URL}/v1/metrics"
export OTEL_EXPORTER_OTLP_METRICS_HEADERS="X-P-API-Key=${PARSEABLE_API_KEY},X-P-Stream=claudecode-metrics,X-P-Log-Source=otel-metrics"
claudeFor a self-hosted deployment that uses basic authentication, replace X-P-API-Key=${PARSEABLE_API_KEY} in each header value with Authorization=Basic <base64-encoded-username-and-password>.
Enable beta traces
Add the trace exporter configuration before starting Claude Code:
export CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1
export OTEL_TRACES_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/json
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="${PARSEABLE_URL}/v1/traces"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="X-P-API-Key=${PARSEABLE_API_KEY},X-P-Stream=claudecode-traces,X-P-Log-Source=otel-traces"Claude Code requires both CLAUDE_CODE_ENABLE_TELEMETRY=1 and CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1 for traces. Anthropic may change the beta schema between releases.
Configure a team
Administrators can place the same values in Claude Code managed settings. Replace the URL and API key placeholders before deployment:
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_LOGS_PROTOCOL": "http/json",
"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT": "https://<your-parseable-host>:8000/v1/logs",
"OTEL_EXPORTER_OTLP_LOGS_HEADERS": "X-P-API-Key=<parseable-api-key>,X-P-Stream=claudecode-logs,X-P-Log-Source=otel-logs",
"OTEL_EXPORTER_OTLP_METRICS_PROTOCOL": "http/json",
"OTEL_EXPORTER_OTLP_METRICS_ENDPOINT": "https://<your-parseable-host>:8000/v1/metrics",
"OTEL_EXPORTER_OTLP_METRICS_HEADERS": "X-P-API-Key=<parseable-api-key>,X-P-Stream=claudecode-metrics,X-P-Log-Source=otel-metrics"
}
}Add the beta trace variables from the previous section if your team collects traces. Managed settings let administrators lock the organization's OTLP destination. Check Anthropic's managed settings documentation before rollout.
Verify ingestion
Start Claude Code and submit one prompt. Then check:
claudecode-logscontains aclaude_code.user_promptevent.claudecode-metricscontainsclaude_code.session.count.- If you enabled beta traces,
claudecode-tracescontains aclaude_code.interactionroot span.
Run Claude Code with debug logging if no telemetry arrives:
claude --debugImport the dashboard
Download the Claude Code Usage dashboard and import its JSON file in Parseable. Map:
- Logs Dataset to
claudecode-logs - Metrics Dataset to
claudecode-metrics
Use the dashboard to track cost, API requests, sessions, tokens, tools, errors and code activity.

Protect sensitive content
Claude Code redacts prompts, responses, tool details and tool content by default. Keep these defaults unless your data policy permits content capture.
| Setting | Captured data |
|---|---|
OTEL_LOG_USER_PROMPTS=1 | User prompt text |
OTEL_LOG_ASSISTANT_RESPONSES=1 | Assistant response text |
OTEL_LOG_TOOL_DETAILS=1 | Tool parameters, commands, file paths and MCP names |
OTEL_LOG_TOOL_CONTENT=1 | Tool input and output content in trace events |
Troubleshooting
- No datasets appear: confirm Claude Code can reach Parseable and that each signal has the correct endpoint,
X-P-StreamandX-P-Log-Sourcevalue. - Metrics arrive but logs do not: confirm
OTEL_LOGS_EXPORTER=otlpand submit a prompt after restarting Claude Code. - Traces do not arrive: set both beta variables and confirm your Claude Code version supports enhanced telemetry.
- Parseable rejects exports: verify the API key and use the Parseable ingestor URL, including its port.
- The dashboard is empty: map its dataset variables to
claudecode-logsandclaudecode-metrics.
Was this page helpful?