Telemetry and Debug
These variables control what Claude Code reports and how much it logs. They turn telemetry on or off, configure OpenTelemetry (OTEL) exporters, and set debug output. Use them to opt out of reporting or to send metrics to your own collector.
This page lists 141 variables. DISABLE_TELEMETRY opts out when it has any non-empty value, even 0 or false. Unset it to turn telemetry back on. DO_NOT_TRACK=1 has the same effect. Set these in your shell or managed settings. OTEL exporter variables in project or local settings do not apply, apart from a few off values.
Example
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
claude
Claude Code sends OTEL metrics to your local collector.
Variables
The rows are in name order. See Environment Variables for what each column and badge means.
| Variable | Status | What it does | Values and default | Notes |
|---|---|---|---|---|
ANTHROPIC_ | Undocumented: Only the program shows this item. It can change without notice. | The bundled SDK reads it as the SDK log level when the client options give none. | Text, level by default. The SDK checks it and falls back to its own default level | Bundled SDK client. Not set from project env before trust |
BETA_ | Documented: An official docs page names this item. Gated: Works only behind a flag or a server gate. Works only behind a feature flag or server gate Experimental: The program or the official docs call this experimental or beta. | Sends detailed beta traces and logs to this OTLP/HTTP endpoint. Claude Code adds / and /. | Text. Works only with ENABLE_ set and when a second gate passes | All sessions. Docs say project and local settings ignore it |
CCR_ | Undocumented: Only the program shows this item. It can change without notice. Gated: Works only behind a flag or a server gate. Works only behind a feature flag or server gate | Passes runner startup timing fields to Claude Code. It merges them into the startup timing record. | Text. The self-hosted runner sets it for the child. Needs CLAUDE_ or CLAUDE_ | Cloud remote and self-hosted runner sessions |
CCR_ | Undocumented: Only the program shows this item. It can change without notice. Gated: Works only behind a flag or a server gate. Works only behind a feature flag or server gate | Gives the spawn time in ms. Claude Code uses it to measure time from spawn to exec, first message read, and input ready. | A number of milliseconds. Integer parsed with parse, else ignored. The self-hosted runner sets it | Cloud remote and self-hosted runner sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Overrides the user. metric attribute. | Text. Used only when OTEL_ is on and an account UUID exists. Else Claude Code derives a tagged id | OTEL metrics. Not set from project env before trust |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Marks a run that the Claude Code GitHub Action started. Claude Code reports the flag in environment metadata. | On or off | GitHub Action runs. Not set from project env before trust |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Makes every non-interactive process send the AGENTS. usage rows. Without it a stored usage- note for the session keeps them from going out twice. Added in 2.. | On or off, off by default. An interactive session always sends them. Read by the module that loads AGENTS. files when a project has no CLAUDE. | Non-interactive sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Turns on live counts in the terminal renderer. No visible effect in a print-mode probe (Probes). | On or off. Sets live on the renderer | Interactive UI |
CLAUDE_ | Documented: An official docs page names this item. | Opts a BYOC environment in to a Datadog-related path. The BYOC runner passes it to the session. No visible effect in a print-mode probe (Probes). | On or off. A helper returns true when CLAUDE_ is byoc and this is unset | BYOC remote sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. Gated: Works only behind a flag or a server gate. Works only behind a feature flag or server gate | Picks llm or heuristic summaries for the session classifier. | On or off. Else a feature flag decides. A feature flag can force heuristic | All sessions, gated by a feature flag |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Sets how often the Datadog log sender flushes its batch. | A number of milliseconds. Falls back to a built-in default | Datadog event logging |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Sets how often the error tracking client sends its batch to the Datadog browser intake. | A number of milliseconds, 30000 by default | Error reporting |
CLAUDE_ | Documented: An official docs page names this item. | Sets the minimum level written to the debug log. | Text, debug by default. Valid levels only, default debug | All sessions |
CLAUDE_ | Documented: An official docs page names this item. | Sets the path of the debug log file. Despite the name it is a file path. One code branch adds <session- to a learned directory. | Text. Default ~/.. Debug mode must be on | All sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Sets a file that receives diagnostics events as JSON lines with a timestamp, level, event and data. It also enables extra diagnostics code. | Text. Other code only tests whether it has a value | All sessions, also forwarded to child processes |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Turns off a shortcut that ends an event log call early. The shortcut applies when the program has already warned that no event logger is set up, and the session is idle and unwatched. Added in 2.. | On or off, off by default | All sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Turns off the helper that emits guest vitals. The helper is also off in essential-traffic-only mode. | On or off, off by default. The log says guest vitals are disabled | Guest and container sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Turns on collection and reporting of startup timing phases, as CLAUDE_ does. | On or off, off by default. Reported fields include the entrypoint value | All sessions |
CLAUDE_ | Documented: An official docs page names this item. | Routes the session quality survey to your own OTEL collector when Anthropic-bound traffic is blocked. | On or off, off by default. When on, the survey gate no longer follows the nonessential-traffic check | All sessions. Project env can set it before trust |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Makes / send the whole transcript as a feedback bundle. | On or off, off by default. Used in the / command path | First-party sessions |
CLAUDE_ | Documented: An official docs page names this item. Differs: The official docs and the program disagree. The row says how. The official docs and the program disagree. The row says how. | Turns on OTEL metrics and logs. The docs say project and local settings ignore it. | On or off. Needs an OTEL exporter that is not none | All sessions. Project env can set it before trust |
CLAUDE_ | Documented: An official docs page names this item. Experimental: The program or the official docs call this experimental or beta. | Turns on the enhanced tracing beta, with OTEL_. ENABLE_ is the fallback name. | On or off. An on-style value turns it on. An off-style value turns it off. Any other value turns it off | All sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Appends a JSON line with render phase timing per frame to this file. | Text, off by default | Interactive terminal UI |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Logs memory stats for every Nth frame in the frame timing log. | A number. Whole number, minimum 1 after fallback. Used only with CLAUDE_ | Interactive terminal UI |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Keeps the GrowthBook disk cache on when telemetry is off. | On or off, off by default. Needs DISABLE_ unset | First-party sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Reports the host platform in the environment record. A host app can set it when the host OS differs from the build. | Text. Claude Code also exposes it as host in a policy facts object | All sessions |
CLAUDE_ | Documented: An official docs page names this item. | Caps the length of content-bearing OpenTelemetry attributes. Truncated text gets a [TRUNCATED - marker. | A number, 61440 by default. Whole number of 1 or more in plain digits. The code takes the smallest of it and the three OTEL_ vars | All sessions, when OTEL content logging is on |
CLAUDE_ | Documented: An official docs page names this item. | Writes OpenTelemetry exporter diagnostic errors to stderr. Without it they go only to the debug log. | On or off. Claude Code removes it from the env of shell tool subprocesses | All sessions |
CLAUDE_ | Documented: An official docs page names this item. | Sets how long Claude Code waits to flush pending OpenTelemetry data. | A number of milliseconds, 5000 by default. Whole number in ms. The trace flush uses half of the value | All sessions, when OTEL is on |
CLAUDE_ | Documented: An official docs page names this item. | Sets how long the output of the OTEL headers helper stays cached before a refresh. | A number of milliseconds. Whole number in ms. The docs default is 1740000 | All sessions, when an OTEL headers helper is set |
CLAUDE_ | Documented: An official docs page names this item. | Sets how long the OpenTelemetry exporters get to finish at exit. | A number of milliseconds, 2000 by default. Whole number in ms. The exporter timeout caps it at an internal maximum and subtracts 250 ms | All sessions, when OTEL is on |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | The only read site logs [Perfetto] initialize to the debug log. In a test with 2., with a value of 1, a file path, and a folder path, in - (also with CLAUDE_), no trace file was written anywhere. A test in the interactive screen on 2. (a pty, one turn answered, the same three values with CLAUDE_) also wrote none (Probes). | Text. Any value only reaches that debug line | All sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Turns on query profiling. The report shows TTFT, pre-request overhead, and network latency. | Set to 1. Without it a message says Query profiling not enabled | All sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Turns on startup profiling marks. Without it, Claude Code profiles a random sample of runs (5 percent in one profiler and 0.5 percent in another). | On or off. Memory snapshots are part of the report | All sessions |
CLAUDE_ | Documented: An official docs page names this item. | Sends the W3C traceparent header on custom proxy URLs. | On or off. The check is true for direct Anthropic API use or when this variable has a value | All sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Gives the log path that Claude Code writes into the concurrent-session pid file record. | Text. Only stored as log in the record | Concurrent-session registry |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the ms threshold for slow-operation timing around calls such as JSON.. | A number of milliseconds. The default is no limit (Infinity) | All sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Gives the spawn time of the process, in ms. The headless profiler uses it as the start for startup timing. | A number of milliseconds. Integer. Claude Code checks CCR_ first | Headless and print mode |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Adds a tags string to the environment info that Claude Code sends with its telemetry. | Text | All sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Passes a trigger ID into a feature flag event as trigger_. | Text. No other effect seen | All sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Adds host paths to each event as workspace.. | Text. Split on the pipe character into a list | Hosted workspaces |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Logs Node process warnings to the debug log. | On or off | All sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Names a file where the PTY host records the terminal output of its child. | - | - |
DEBUG | Documented: An official docs page names this item. | Turns on debug mode when truthy. | - | - |
DEBUG_ | Undocumented: Only the program shows this item. It can change without notice. | In the SDK, forwards the CLI stderr to the caller and sets DEBUG to 1 for the child. | - | - |
DEBUG_ | Undocumented: Only the program shows this item. It can change without notice. | Turns on debug mode at start. | - | - |
DISABLE_ | Documented: An official docs page names this item. | Opts out of error reporting. | On or off | - |
DISABLE_ | Documented: An official docs page names this item. | Opts out of telemetry. The bundle also treats it as "no-telemetry" mode for other non-essential traffic checks. | Text. Any non-empty string counts, so 0 and false still opt out. Claude Code passes it to remote child sessions | All sessions. Not set from project env before trust |
DO_ | Documented: An official docs page names this item. | Opts out of telemetry like DISABLE_ does. | On or off. Claude Code parses it as a standard boolean, so 0 or false leaves telemetry on | All sessions. Not set from project env before trust |
ENABLE_ | Documented: An official docs page names this item. Gated: Works only behind a flag or a server gate. Works only behind a feature flag or server gate Experimental: The program or the official docs call this experimental or beta. | Turns on detailed beta tracing. It needs BETA_ as well. | On or off. Also needs a non-empty BETA_. Gated by an org check or a feature flag | Tracing. Not set from project env before trust |
ENABLE_ | Documented: An official docs page names this item. | Turns on enhanced telemetry tracing. It is the fallback name of CLAUDE_. | On or off. Truthy values enable it. Claude Code reads the CLAUDE_ name first with ?? | Tracing. Not set from project env before trust |
GITHUB_ | Undocumented: Only the program shows this item. It can change without notice. | Passes the action inputs to a startup telemetry field named github. | Text | GitHub Actions. Not set from project env before trust |
GITHUB_ | Undocumented: Only the program shows this item. It can change without notice. | Sends the actor id as telemetry metadata when GITHUB_ is on. | Text | GitHub Actions. Not set from project env before trust |
GITHUB_ | Undocumented: Only the program shows this item. It can change without notice. | Sends the event name as telemetry metadata when GITHUB_ is on. | Text | GitHub Actions. Not set from project env before trust |
GITHUB_ | Undocumented: Only the program shows this item. It can change without notice. | Sends the repository name as telemetry metadata when GITHUB_ is on. | Text | GitHub Actions. Not set from project env before trust |
GITHUB_ | Undocumented: Only the program shows this item. It can change without notice. | Sends the repository id as telemetry metadata when GITHUB_ is on. | Text | GitHub Actions. Not set from project env before trust |
GITHUB_ | Undocumented: Only the program shows this item. It can change without notice. | Sends the repository owner as telemetry metadata when GITHUB_ is on. | Text | GitHub Actions. Not set from project env before trust |
GITHUB_ | Undocumented: Only the program shows this item. It can change without notice. | Sends the repository owner id as telemetry metadata when GITHUB_ is on. | Text | GitHub Actions. Not set from project env before trust |
GOOGLE_ | Undocumented: Only the program shows this item. It can change without notice. | Turns on debug logging in the bundled Google libraries when it is set. | On or off | Google auth library |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the OTel SDK limit for the number of attributes per log record and span. | A number | - |
OTEL_ | Documented: An official docs page names this item. | Sets the OTel limit for the length of an attribute value. Claude Code caps content attributes at the smaller limit. | A number | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the export timeout, in ms, of the OTel log record batch processor. | - | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the maximum number of records per export for the OTel log record batch processor. | A number | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the queue size of the OTel log record batch processor. | A number | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the delay, in ms, between exports for the OTel log record batch processor. | - | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the export timeout, in ms, of the OTel span batch processor. | - | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the maximum number of spans per export for the OTel span batch processor. | A number | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the queue size of the OTel span batch processor. | A number | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the delay, in ms, between exports for the OTel span batch processor. | - | - |
OTEL_ | Documented: An official docs page names this item. | Gives the root CA file for the OTLP exporter. Signal-specific vars win. | - | - |
OTEL_ | Documented: An official docs page names this item. | Gives the client certificate file for OTLP mutual TLS. | - | - |
OTEL_ | Documented: An official docs page names this item. | Gives the client private key file for OTLP mutual TLS. | Text (a secret) | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets OTLP compression. Signal-specific vars win. | - | - |
OTEL_ | Documented: An official docs page names this item. | Sets the OTLP collector endpoint for metrics, logs, and traces. | A URL | - |
OTEL_ | Documented: An official docs page names this item. | Sets extra OTLP request headers as key=value pairs. | - | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Makes the gRPC OTLP exporter use an insecure channel when the value is true. | - | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Gives the root CA file for the OTLP logs exporter. | - | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Gives the client certificate file for the OTLP logs exporter. | - | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Gives the client key file for the OTLP logs exporter. | Text (a secret) | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets OTLP compression for logs only. | - | - |
OTEL_ | Documented: An official docs page names this item. | Sets the OTLP endpoint for logs only. | A URL | - |
OTEL_ | Documented: An official docs page names this item. | Sets OTLP headers for logs only. | - | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Makes the gRPC OTLP logs exporter use an insecure channel when true. | - | - |
OTEL_ | Documented: An official docs page names this item. | Chooses the OTLP protocol for logs. Falls back to OTEL_. | - | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Gives the root CA file for the OTLP metrics exporter. | - | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Gives the client certificate file for the OTLP metrics exporter. | - | - |
OTEL_ | Documented: An official docs page names this item. | Gives the client key file for the OTLP metrics exporter. | Text (a secret) | - |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets OTLP compression for metrics only. | - | - |
OTEL_ | Documented: An official docs page names this item. | Sets the OTLP endpoint for metrics only. | A URL | - |
OTEL_ | Documented: An official docs page names this item. | Sets extra HTTP headers on the OTLP metrics export. | Text. Overrides OTEL_ | Metrics exporter with http/, http/ or grpc. Ignored in project and local env |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Allows an insecure (non-TLS) connection for the OTLP metrics exporter. | Text | Metrics exporter. Ignored in project and local env |
OTEL_ | Documented: An official docs page names this item. | Picks the OTLP wire protocol for metrics. Falls back to OTEL_. | Text. Another value throws an Unknown protocol error | Metrics exporter when OTEL_ has otlp. Ignored in project and local env |
OTEL_ | Documented: An official docs page names this item. | Chooses delta or cumulative temporality for exported OTLP metrics. | Text. When unset, Claude Code sets it to delta at telemetry start | Metrics exporter. Project env can set it before trust |
OTEL_ | Documented: An official docs page names this item. | Sets the default OTLP wire protocol for metrics, logs and traces. | Text. A per-signal ..._ wins | Telemetry exporters with otlp. Ignored in project and local env |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the OTLP export timeout in ms for every signal. | A number. A per-signal OTEL_ wins. A bad value logs a warning | OTLP exporters. Not set from project env before trust |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the root CA file that the OTLP traces exporter trusts. | Falls back to OTEL_. A read failure logs a warning | Traces exporter. Ignored in project and local env |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the client certificate file for mTLS on the OTLP traces exporter. | Falls back to OTEL_. Needs the matching client key | Traces exporter. Ignored in project and local env |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the client private key file for mTLS on the OTLP traces exporter. | Text (a secret). Falls back to OTEL_. Needs the matching client certificate | Traces exporter. Ignored in project and local env |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the compression of OTLP trace requests. | Text. Claude Code ignores another value and logs a warning. Falls back to OTEL_ | Traces exporter. Project env can set it before trust |
OTEL_ | Documented: An official docs page names this item. Gated: Works only behind a flag or a server gate. A feature flag or server gate decides by default. This variable overrides it | Sets the OTLP traces endpoint URL. A valid value in remote mode also forces http/ for traces. | Text. The remote check needs https or localhost http, no credentials, no query, and a path that ends in traces | Traces exporter. Remote check needs CLAUDE_. Not set from project env before trust |
OTEL_ | Documented: An official docs page names this item. | Sets extra HTTP headers on the OTLP traces export. | Text. Overrides OTEL_ | Traces exporter. Ignored in project and local env |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Allows an insecure (non-TLS) connection for the OTLP traces exporter. | Text | Traces exporter. Ignored in project and local env |
OTEL_ | Documented: An official docs page names this item. | Picks the OTLP wire protocol for traces. Falls back to OTEL_. | Text. A valid remote OTEL_ forces http/ | Traces exporter when OTEL_ has otlp. Ignored in project and local env |
OTEL_ | Documented: An official docs page names this item. | Sets the host that the Prometheus metrics exporter binds to. | Falls back to the SDK default | Metrics exporter with prometheus. Ignored in project and local env |
OTEL_ | Documented: An official docs page names this item. | Sets the port that the Prometheus metrics exporter listens on. | A number, port by default. Falls back to the SDK default port | Metrics exporter with prometheus. Ignored in project and local env |
OTEL_ | Documented: An official docs page names this item. | Includes the model response text in assistant_ log events. | On, off, or unset. When unset, the value of OTEL_ applies. 0 keeps responses redacted | All entrypoints. Ignored in project and local env. Project env may set only an off value |
OTEL_ | Documented: An official docs page names this item. | Adds redacted managed settings and a SHA-256 digest to managed_ events. | On or off. Reads managed and user layers first, and skips project and local scopes | All entrypoints. Ignored in project and local env |
OTEL_ | Documented: An official docs page names this item. | Logs raw Messages API request and response JSON as events. | Off by default. 1 (bool values) means inline. file: writes full bodies to disk with a body_ | All entrypoints, not diskless hosts. Ignored in project and local env |
OTEL_ | Documented: An official docs page names this item. | Includes tool content in the tool. span event. | On or off. Needs tracing on | All entrypoints with tracing. Ignored in project and local env. Project env may set only an off value |
OTEL_ | Documented: An official docs page names this item. | Includes tool input, MCP server names, raw errors and similar details in telemetry. | On or off. It also adds classifier_ on tool_ events | All entrypoints. Ignored in project and local env. Project env may set only an off value |
OTEL_ | Documented: An official docs page names this item. | Includes user prompt text in OpenTelemetry traces and logs. | On or off. Off by default, so prompts show as <REDACTED> | All entrypoints. Ignored in project and local env. Project env may set only an off value |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Limits the number of attributes on each OTLP log record. | A number. Falls back to OTEL_, then 128 | Log exporters. Not set from project env before trust |
OTEL_ | Documented: An official docs page names this item. | Limits the length of each log record attribute value. Also lowers the content cut-off for prompts and tool content. | A number, unlimited by default. An integer, minimum 0, with no limit by default. The content cut-off is the lowest of this, the span and general limits, and CLAUDE_ (61440) | Log exporters and OTEL content fields. Not set from project env before trust |
OTEL_ | Documented: An official docs page names this item. | Sets the log batch export delay in ms. | A number, 5000 by default. Integer. The first-party event logger reads it too (default 10000 from the process env) | Log exporters. Project env can set it before trust |
OTEL_ | Documented: An official docs page names this item. | Chooses the exporters for OpenTelemetry log events. | A comma-separated list. Needs CLAUDE_. In stream-json output mode Claude Code removes console from it | All entrypoints. Project settings may only set none. Ignored in project and local env |
OTEL_ | Documented: An official docs page names this item. | Sets the metric export interval in ms for the OTLP and console readers. | A number, 60000 by default. Integer | Metrics exporters. Project env can set it before trust |
OTEL_ | Documented: An official docs page names this item. | Chooses the exporters for OpenTelemetry metrics. | A comma-separated list. Needs CLAUDE_. In stream-json output mode, Claude Code removes console | All entrypoints. Project settings may only set none. Ignored in project and local env |
OTEL_ | Documented: An official docs page names this item. | Adds the account UUID (and a tagged id) to metric attributes. | On or off, on by default. Claude Code parses any set value as a boolean, so only 1, true, yes, on keep it | Metrics. Project env can set it before trust |
OTEL_ | Documented: An official docs page names this item. | Adds the session entrypoint as app. to metric attributes. | On or off, off by default. Claude Code parses any set value as a boolean | Metrics. Project env can set it before trust |
OTEL_ | Documented: An official docs page names this item. | Adds vcs. repository attributes to metrics and events. | On or off, off by default. Claude Code parses any set value as a boolean | Metrics and events. Project env can set it before trust |
OTEL_ | Documented: An official docs page names this item. | Adds OTEL_ keys to metric attributes. | On or off, on by default. Claude Code parses any set value as a boolean. Claude Code skips user. and identity. keys when the host supplies identity | Metrics. Project env can set it before trust |
OTEL_ | Documented: An official docs page names this item. | Adds session. (and the remote session id) to metric attributes. | On or off, on by default. Claude Code parses any set value as a boolean | Metrics. Project env can set it before trust |
OTEL_ | Documented: An official docs page names this item. | Adds the Claude Code version as app. to metric attributes. | On or off, off by default. Claude Code parses any set value as a boolean | Metrics. Project env can set it before trust |
OTEL_ | Documented: An official docs page names this item. | Adds custom resource attributes to telemetry, and to metric labels. | Text. Claude Code drops bad pairs | All entrypoints. Project env can set it before trust |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the service. resource attribute of exported telemetry. | Text | Telemetry. Project env can set it before trust |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Limits the attributes on each span. | A number. Falls back to OTEL_, then 128 | Tracing. Not set from project env before trust |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Limits the attributes on each span event. | A number, 128 by default | Tracing. Not set from project env before trust |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Limits the attributes on each span link. | A number, 128 by default | Tracing. Not set from project env before trust |
OTEL_ | Documented: An official docs page names this item. | Limits the length of span attribute values. Also lowers the content cut-off. | A number, unlimited by default. An integer, minimum 0, with no limit by default. The content cut-off is the lowest of this, the log and general limits, and CLAUDE_ | Tracing and OTEL content fields. Not set from project env before trust |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Limits the events on each span. | A number, 128 by default | Tracing. Not set from project env before trust |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Limits the links on each span. | A number, 128 by default | Tracing. Not set from project env before trust |
OTEL_ | Documented: An official docs page names this item. | Sets the trace batch export delay in ms. | A number, 5000 by default. Integer | Traces exporters. Project env can set it before trust |
OTEL_ | Documented: An official docs page names this item. | Chooses the exporters for OpenTelemetry traces. | A comma-separated list. Needs telemetry and tracing on. In stream-json output mode, Claude Code removes console | All entrypoints. Project settings may only set none. Ignored in project and local env |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Chooses the trace sampler. | Text, parentbased_ by default | Tracing. Not set from project env before trust |
OTEL_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the sampling ratio for the traceidratio samplers. | A number. Blank or out of range logs an error and uses 1 | Tracing with a ratio sampler. Not set from project env before trust |
SRT_ | Undocumented: Only the program shows this item. It can change without notice. | Turns on [Sandbox log lines in the bundled sandbox runtime. | Any non-empty value turns it on. Level picks console., console., or log | Sandbox runtime |
SWE_ | Undocumented: Only the program shows this item. It can change without notice. | Sends the SWE-bench instance id in event metadata. | Text. Empty string when unset. Goes into the event fields (swe) | All sessions, telemetry only |
SWE_ | Undocumented: Only the program shows this item. It can change without notice. | Sends the SWE-bench run id in event metadata. | Text. Empty string when unset. Goes into the event fields (swe) | All sessions, telemetry only |
SWE_ | Undocumented: Only the program shows this item. It can change without notice. | Sends the SWE-bench task id in event metadata. | Text. Empty string when unset. Goes into the event fields (swe) | All sessions, telemetry only |
TRACEPARENT | Documented: An official docs page names this item. | Gives the parent trace context. Claude Code uses it as the parent of its OTEL spans. | Text. Non-empty W3C traceparent string. Used only when a tracing gate is on | All sessions, when OTEL tracing is on |
TRACESTATE | Documented: An official docs page names this item. | Gives the trace state for TRACEPARENT. Claude Code passes it to the OTEL propagator. | Text. Claude Code uses it only when TRACEPARENT has a value and tracing is on | All sessions, when OTEL tracing is on |
How It Works
Telemetry features read their variables once at startup, so a change to env in a settings file needs a restart.
DISABLE_TELEMETRY and DO_NOT_TRACK also turn off feature-flag fetching, so features that depend on server flags stop working.
The official docs list the affected features under Features That Need Feature-Flag Fetching.
Since 2.1.307 Claude Code logs a claude_code.safety_event OpenTelemetry event for each tool call that a permission rule, auto mode, a safety check, a hook, or the sandbox stopped, prompted, or sent back (release notes).
In the program the event is safety_event, behind a feature flag that is on by default.
Its attributes include category (such as permission_rule, auto_mode_block, hook, hook_review, sandbox_network, and user_rejected), decision, decision_source, reason_type, reason_code, rule_source, tool_name, tool_class, tool_source, permission_mode, tool_use_id, sandbox_enabled, and sandbox_violation_count.
A PostToolUse hook that sends a result back gives category hook_review, decision sent_back, and decision_source hook (the program).
When the output of a command shows a git commit, the tool_result event for that call also has vcs.ref.head.revision (the commit ID). When Claude Code knows the branch, the event also has vcs.ref.head.name and vcs.ref.head.type branch (the program).
Exact Fields
Find the exact fields of each OpenTelemetry metric, span, and event at https://clawdipedia.cc/schemas/claude-code-otel.json. The program builds this payload in code, not with a validator. The schema comes from that code. A field marked x-unverified has a type the code does not show. The mark x-observed shows a field that a probe saw.
It lists every field of this release. Build on the fields it names. Look each field up there before you rely on it.
Related Pages
- Environment Variables: how Claude Code reads variables and which value wins.
- OpenTelemetry Events: the events that Claude Code emits and their attributes.
- Monitoring (see the official docs)
- Undocumented Items: every item that only the program shows.
Source: the program (variable names found in the 2.1.312 binary) and the Environment Variables page of the official docs.