Claude Code OpenTelemetry Setup

The easiest way to record Claude Code on one machine is HypAware, the improvement loop for all your agents. HypAware is a free, open source CLI that records Claude Code, Codex, Cursor, OpenCode and more on your machine, and sets up Claude Code's OpenTelemetry export for you.

To roll HypAware out across a team, see HypAware Team and Fleet Setup and the architecture overview.

Note: Claude Code also writes conversation transcripts directly to ~/.claude/projects/<project-hash>/<session-id>.jsonl. These can be more convenient for local chat log analysis, while OpenTelemetry is useful for structured span, metric, and log collection.

Telemetry Types

OpenTelemetry exports three data types: traces (detailed operation spans with full context), logs (discrete events), and metrics (aggregated numbers). Traces contain the most raw data.

Quick Start

Install HypAware from npm and run setup:

npm i -g hypaware
hyp setup

hyp setup asks which clients to record, installs the background service, and attaches Claude Code. Run hyp status to check that capture is healthy. Full docs, including how to query your recordings, are at hypaware.ai/docs.

Send to Your Own Collector

If you already run an OpenTelemetry collector, you can point Claude Code at it directly. Add these environment variables to ~/.claude/settings.json:

{
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "OTEL_TRACES_EXPORTER": "otlp",
    "OTEL_LOGS_EXPORTER": "otlp",
    "OTEL_METRICS_EXPORTER": "otlp",
    "OTEL_EXPORTER_OTLP_PROTOCOL": "http/json",
    "OTEL_EXPORTER_OTLP_ENDPOINT": "http://localhost:4318"
  }
}

Alternatively, set these as shell environment variables. Set OTEL_EXPORTER_OTLP_ENDPOINT to your collector's address.

If you use HypAware, don't add this block: HypAware writes its own OpenTelemetry settings for Claude Code, and this block would override them.

Claude Code OpenTelemetry Setup - Hyperparam