Claude Code
Shell (each computer)
In ~/.zshrc, ~/.bashrc or the environment Claude Code starts in
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT=https://otel.example.com:4318
export OTEL_RESOURCE_ATTRIBUTES=team=platform,department=engineeringManaged settings (whole organisation)
In the env block of Claude Code's managed settings file
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://otel.example.com:4318",
"OTEL_RESOURCE_ATTRIBUTES": "team=platform,department=engineering"
}
}What each setting does
- CLAUDE_CODE_ENABLE_TELEMETRY
- Turns telemetry on (required).
- OTEL_METRICS_EXPORTER / OTEL_LOGS_EXPORTER
- Send metrics (including claude_code.cost.usage and claude_code.token.usage) and events over OTLP.
- OTEL_EXPORTER_OTLP_PROTOCOL
- The OTLP protocol. Claude Code has no default, so it is always set.
- OTEL_EXPORTER_OTLP_ENDPOINT
- Your collector, for every signal.
- OTEL_RESOURCE_ATTRIBUTES
- Labels such as team or department on everything sent. Values can't contain spaces, so they are percent-encoded.
- OTEL_LOG_USER_PROMPTS / OTEL_LOG_TOOL_DETAILS
- Left unset: prompt text and tool details stay out (the default).
- Claude Code ignores these exporter settings in a repository's .claude/settings.json: use managed settings, ~/.claude/settings.json or the shell.
Source, checked on 22 October 2026: Claude Code: Monitoring (opens in a new tab)