← Claude Docs

Monitoring - Claude Code Docs

Claude Docs · April 8, 2026
Track Claude Code usage, costs, and tool activity across your organization by exporting telemetry data through OpenTelemetry (OTel). Claude Code exports metrics as time series data via the standard metrics protocol, events via the logs/events protocol, and

Detailed Analysis

Anthropic's Claude Code now supports comprehensive telemetry and observability through native OpenTelemetry (OTel) integration, enabling organizations to track usage, costs, and tool activity at scale. The documentation outlines a three-signal telemetry architecture: metrics exported as time series data, events and logs exported via the logs/events protocol, and distributed traces via the traces protocol — the last of which remains in beta. Configuration is handled entirely through standard environment variables, with `CLAUDE_CODE_ENABLE_TELEMETRY=1` serving as the master switch. Supported exporters include OTLP (the primary OpenTelemetry protocol), Prometheus, and a console output for debugging, giving teams flexibility to route data to virtually any modern observability backend such as Datadog, Grafana, Honeycomb, or self-hosted OpenTelemetry Collectors.

A notable feature of the implementation is centralized, administrator-driven configuration. Managed settings files allow IT and platform teams to push telemetry configuration uniformly across all users in an organization, overriding individual defaults through a defined settings precedence hierarchy. This is significant for enterprise deployments where governance over data egress, endpoint destinations, and authentication — including mutual TLS — must be enforced consistently. The inclusion of `OTEL_EXPORTER_OTLP_HEADERS` and mTLS certificate variables signals that Anthropic is designing for security-sensitive corporate environments, not just individual developers.

The documentation gives careful attention to metrics cardinality — a practical concern that directly impacts the cost and performance of time-series databases like Prometheus or Thanos. Administrators can toggle whether attributes like `session.id`, `app.version`, and `user.account_uuid` are included in metric dimensions, allowing teams to trade off granularity against storage efficiency. Similarly, several content-logging flags (`OTEL_LOG_USER_PROMPTS`, `OTEL_LOG_TOOL_DETAILS`, `OTEL_LOG_TOOL_CONTENT`) are disabled by default, reflecting a deliberate privacy-first posture: detailed prompt and tool content is opt-in, not opt-out, and tool content in spans is capped at 60 KB.

The distributed tracing feature, gated behind the `CLAUDE_CODE_ENHANCED_TELEMETRY_BETA` flag, is the most architecturally significant addition. By linking user prompts to downstream API calls and tool executions within a single trace context, Claude Code becomes observable in the same way a modern microservices application is — engineers can inspect latency, identify failures, and understand causal chains through a familiar tracing UI. The fact that spans redact user prompt content by default further underscores the privacy design philosophy. This capability bridges the gap between AI tooling and standard site reliability engineering (SRE) practices, treating an AI coding assistant as a first-class observable system component.

Broader, this telemetry architecture reflects a maturing pattern across the AI tooling industry: as agentic systems like Claude Code move into production enterprise environments, the demand for operational visibility, cost attribution, and audit logging has grown from a nice-to-have to a hard requirement. Anthropic's adoption of OpenTelemetry — an open, vendor-neutral CNCF standard — rather than a proprietary observability SDK is a strategically sound choice that lowers integration friction and signals commitment to existing DevOps workflows. It positions Claude Code not as a standalone productivity tool but as an auditable, governable component of enterprise software development infrastructure, capable of fitting into the same observability stacks organizations already use for their production services.

Read original article →