What this thread does
As of November 2026, use Claude Code's OpenTelemetry export for token and estimated-cost trends across machines, and inspect content-logging flags before a team rollout.
Do first: run the console example below, start Claude Code and verify receipt before a team rollout. The monitoring reference, read November 3, documents the variables and intervals.
Anthropic's 2.1.312 notes remove claude_code.safety_event, while 2.1.317 adds plan, seat, provider and custom-base-URL attributes and fixes proxy export failures; use the release-specific behavior when interpreting missing events (checked 2026-11-05).
Why
@ClaudeCode_love (20 September 2026, in Japanese) summarised an Anthropic workshop on lowering Claude Code token use; its last part was about measuring first. With telemetry on, a team can see per person and per model where tokens go, for example one person on Opus for everything or one person with a low cache hit rate.
Try it locally in two minutes
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=console
export OTEL_METRIC_EXPORT_INTERVAL=10000
claude
Metrics print to the terminal every 10 seconds (the default interval is 60). For real use, set OTEL_METRICS_EXPORTER=otlp (or prometheus) OTEL_EXPORTER_OTLP_PROTOCOL (as of November 2026, Claude Code 2.1.323+ defaults to http/protobuf for valid HTTP(S) endpoints; set grpc for gRPC) and OTEL_EXPORTER_OTLP_ENDPOINT to your collector, and roll it out through the env block of managed settings so everyone reports to the same place. You need an OpenTelemetry backend such as Prometheus with Grafana, Honeycomb or Datadog.
The numbers worth watching
From the monitoring docs:
claude_code.token.usagewithtype=input,output,cacheRead,cacheCreation. Theinputtype excludes cached tokens, so cache hit rate is cacheRead divided by input plus cacheRead plus cacheCreation.claude_code.cost.usage(USD) bymodel.- Both carry
query_source(main,subagent,auxiliary,plugin_model_complete,plugin_model_classify),effort, and user and session attributes (user.account_uuid,user.emailwhen available,session.id). - Per-request detail comes from log events, enabled with
OTEL_LOGS_EXPORTER.
Privacy
Prompt text and tool details are redacted unless enabled through OTEL_LOG_USER_PROMPTS, OTEL_LOG_TOOL_DETAILS or OTEL_LOG_TOOL_CONTENT. Assistant-response logging is controlled by OTEL_LOG_ASSISTANT_RESPONSES, which falls back to OTEL_LOG_USER_PROMPTS when unset: set responses explicitly to 0 if prompts are logged but responses should stay redacted, per the current monitoring reference. User email and account IDs are included by default; tell your team what is collected.
Alternatives
ccusage for one machine's history, /usage for the current session.
Questions for replies
Which metric changed how your team works: cache hit rate, model mix, or subagent share? And did the USD figure match your actual bill?
If nothing arrives, run claude --debug-file <path> and look for [3P telemetry] errors.
Sources
Primary source: the Claude Code monitoring docs (Anthropic), read on 18 October 2026. The workshop summary in the linked post could not be opened (the site returned an error), so what the workshop said is unchecked.
- Confirms: the variable names, console, otlp and prometheus exporters, the 60-second default metric interval, the token and cost metrics with their
type,query_sourceandeffortattributes, account id and email being included by default, prompt and tool details staying redacted until switched on, with the assistant-response fallback described above, the managed-settingsenvroute, and the[3P telemetry]debug messages. - Corrected above: as of November 2026, Claude Code 2.1.323+ defaults an
otlpexporter tohttp/protobuffor valid HTTP(S) endpoints; gRPC still needsOTEL_EXPORTER_OTLP_PROTOCOL=grpc. The docs also say OTEL variables in a repo's.claude/settings.jsonare ignored, so use user or managed settings.
New operational fix
2.1.307, October 21, fixes telemetry from Claude Desktop behind a Claude apps gateway being rejected when OTEL_EXPORTER_OTLP_HEADERS is set. It also added a claude_code.safety_event for tool calls stopped, prompted or returned by permission rules, auto mode, checks, hooks or the sandbox; that event was removed in 2.1.312, per the release notes. Update affected installations before diagnosing the collector.
Detailed beta trace model-output fields follow the prompt flag separately. Raw API-body logging is another opt-in that includes conversation content, per the privacy reference.
Evidence: johnplanow's March 11 report #33066 supplies a receiver-level reproduction of missing headless exports on 2.1.72. It illustrates why checking receipt matters; it does not establish a current headless failure or validate the later gateway fix.
Limits
Data only arrives from sessions that received the configuration. Metrics, log events and beta traces are separate export paths; enabling one does not establish what another contains. Reconcile estimated cost with billing separately.
Not for: reading one developer's existing local history; see ccusage-token-cost-report.
checked 2026-11-03
Started from a post by @ClaudeCode_love, packaged by the editor. Original post