We instrumented Claude Code with OpenTelemetry (tokens, cost, latency) (signoz.io)

🤖 AI Summary
Anthropic’s Claude Code has been instrumented with OpenTelemetry and piped into SigNoz, giving teams turnkey visibility into tokens, cost, latency, sessions and developer behavior. By setting CLAUDE_CODE_ENABLE_TELEMETRY=1 and standard OTEL env vars (OTLP/gRPC endpoint, headers/ingestion keys), you can export traces, metrics and logs from VS Code or terminal sessions to SigNoz Cloud or any OTLP-compatible backend. Administrators can enforce telemetry via managed-settings.json (macOS/Linux/Windows paths provided), enabling centralized telemetry configuration and quota monitoring across an organization. Technically, the integration emits a rich set of metrics (claude_code.session.count, lines_of_code.count, pull_request.count, commit.count, claude_code.token.usage, claude_code.cost.usage, claude_code.active_time.total, claude_code.code_edit_tool.decision) plus event logs (e.g., claude_code.user_prompt, with optional full prompt capture via OTEL_LOG_USER_PROMPTS=1). OpenTelemetry provides vendor-neutral collection and flexible exporters (console, Prometheus, multiple backends, separate endpoints/protocols for metrics and logs), while SigNoz supplies dashboards, slices by user/model/terminal (Sonnet vs Opus), alerts, and cost/quota visualization. The result: measurable ROI, cost control, latency and reliability monitoring, behavior insights (accept/reject rates, tooling distribution) and capacity planning—turning Claude Code from a black box into an auditable, optimizable part of the developer workflow.
Loading comments...
loading comments...