Claude Code telemetry is configured through environment variables.
Use this guide when you want to configure Claude Code’s official OpenTelemetry settings and align endpoint/header values with your Opik deployment mode.
Claude Code’s monitoring docs currently describe OTel metrics and events/logs exporters. Opik tracing views are span-based. Verify your pipeline emits spans if your goal is trace visualization in Opik.
For full endpoint/header details, see Opik OpenTelemetry overview.
Required headers:
AuthorizationComet-WorkspaceOptional headers:
projectName (recommended for deterministic routing)Intent: Enable Claude Code telemetry and route supported OTel signals to your collector/backend.
Applies when: You run Claude Code with telemetry enabled via environment variables.
Required fields:
CLAUDE_CODE_ENABLE_TELEMETRY=1OTEL_METRICS_EXPORTER or OTEL_LOGS_EXPORTER)Optional fields:
OTEL_EXPORTER_OTLP_PROTOCOLOTEL_EXPORTER_OTLP_ENDPOINTOTEL_EXPORTER_OTLP_HEADERSOTEL_EXPORTER_OTLP_METRICS_ENDPOINTMinimal valid setup:
claude_code.* metrics/events.