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 139 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 table is sorted by name. See Environment Variables for what each column and badge means.
| Variable | Status | What it does | Values and default | Notes |
|---|---|---|---|---|
ANTHROPIC_ | Undocumented | 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 Gated | 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 Gated | Passes runner startup timing fields to Claude Code. It merges them into the startup timing record. | Text. Set by the self-hosted runner for the child. Needs CLAUDE_ or CLAUDE_ | Cloud remote and self-hosted runner sessions |
CCR_ | Undocumented Gated | 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. Set by the self-hosted runner | Cloud remote and self-hosted runner sessions |
CLAUDE_ | Undocumented | 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 | Marks a run as launched by the Claude Code GitHub Action. Claude Code reports the flag in environment metadata. | On or off | GitHub Action runs. Not set from project env before trust |
CLAUDE_ | Undocumented | 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 | 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 Gated | 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 | 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 | 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 | Sets the minimum level written to the debug log. | Text, debug by default. Valid levels only, default debug | All sessions |
CLAUDE_ | Documented | 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 | Sets a file that receives diagnostics events as JSON lines with a timestamp, level, event and data. Also enables extra diagnostics code. | Text. Other code tests only if it is set | All sessions, also forwarded to child processes |
CLAUDE_ | Undocumented | Kill switch for the guest vitals emitter helper. It 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 | 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 | 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 | 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 Differs | Turns on OTEL metrics and logs. 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 | Turns on the enhanced tracing beta, with OTEL_. ENABLE_ is the fallback name. | On or off. On-style value gives on, off-style gives off, else off | All sessions |
CLAUDE_ | Undocumented | Appends a JSON line with render phase timing per frame to this file. | Text, off by default | Interactive terminal UI |
CLAUDE_ | Undocumented | 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 | Keeps the GrowthBook disk cache on when telemetry is off. | On or off, off by default. Needs DISABLE_ unset | First-party sessions |
CLAUDE_ | Undocumented | Reports the host platform in the environment record. A host app can set it when the host OS differs from the build. | Text. Also exposed as host in a policy facts object | All sessions |
CLAUDE_ | Documented | 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 | 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 | 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 gets half of the value | All sessions, when OTEL is on |
CLAUDE_ | Documented | Sets how long the output of the OTEL headers helper stays cached before a refresh. | A number of milliseconds. Whole number in ms. Docs default is 1740000 | All sessions, when an OTEL headers helper is set |
CLAUDE_ | Documented | 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 | The only read site logs [Perfetto] initialize. No visible effect in a print-mode probe (Probes). | Text. The code that turns it on is not shown | All sessions |
CLAUDE_ | Undocumented | 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 | Turns on startup profiling marks. Without it a random sample of runs (5 percent in one profiler and 0.5 percent in another) is profiled. | On or off. Memory snapshots are part of the report | All sessions |
CLAUDE_ | Documented | Sends the W3C traceparent header on custom proxy URLs. | On or off. The check is true for direct Anthropic API use or when this var is set | All sessions |
CLAUDE_ | Undocumented | Gives the log path that is written into the concurrent-session pid file record. | Text. Only stored as log in the record | Concurrent-session registry |
CLAUDE_ | Undocumented | 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 | Gives the time the process was spawned, in ms. The headless profiler uses it as the start for startup timing. | A number of milliseconds. Integer. CCR_ is checked first | Headless and print mode |
CLAUDE_ | Undocumented | Adds a tags string to the environment info that Claude Code sends with its telemetry. | Text | All sessions |
CLAUDE_ | Undocumented | Passes a trigger ID into a feature flag event as trigger_. | Text. No other effect seen | All sessions |
CLAUDE_ | Undocumented | Adds host paths to each event as workspace.. | Text. Split on the pipe character into a list | Hosted workspaces |
CLAUDE_ | Undocumented | Logs Node process warnings to the debug log. | On or off | All sessions |
CLAUDE_ | Undocumented | Names a file where the PTY host records the terminal output of its child. | - | - |
DEBUG | Documented | Turns on debug mode when truthy. | - | - |
DEBUG_ | Undocumented | In the SDK, forwards the CLI stderr to the caller and sets DEBUG to 1 for the child. | - | - |
DEBUG_ | Undocumented | Turns on debug mode at launch. | - | - |
DISABLE_ | Documented | Opts out of error reporting. | On or off | - |
DISABLE_ | Documented | 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. Passed on to remote child sessions | All sessions. Not set from project env before trust |
DO_ | Documented | Opts out of telemetry like DISABLE_ does. | On or off. Parsed as a standard boolean, so 0 or false leaves telemetry on | All sessions. Not set from project env before trust |
🧪 ENABLE_ | Documented Gated | 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 | Turns on enhanced telemetry tracing. It is the fallback name of CLAUDE_. | On or off. Truthy values enable it. The CLAUDE_ name is read first with ?? | Tracing. Not set from project env before trust |
GITHUB_ | Undocumented | Passes the action inputs to a startup telemetry field named github. | Text | GitHub Actions. Not set from project env before trust |
GITHUB_ | Undocumented | Sends the actor id as telemetry metadata when GITHUB_ is on. | Text | GitHub Actions. Not set from project env before trust |
GITHUB_ | Undocumented | Sends the event name as telemetry metadata when GITHUB_ is on. | Text | GitHub Actions. Not set from project env before trust |
GITHUB_ | Undocumented | Sends the repository name as telemetry metadata when GITHUB_ is on. | Text | GitHub Actions. Not set from project env before trust |
GITHUB_ | Undocumented | Sends the repository id as telemetry metadata when GITHUB_ is on. | Text | GitHub Actions. Not set from project env before trust |
GITHUB_ | Undocumented | Sends the repository owner as telemetry metadata when GITHUB_ is on. | Text | GitHub Actions. Not set from project env before trust |
GITHUB_ | Undocumented | Sends the repository owner id as telemetry metadata when GITHUB_ is on. | Text | GitHub Actions. Not set from project env before trust |
GOOGLE_ | Undocumented | Turns on debug logging in the bundled Google libraries when it is set. | On or off | Google auth library |
OTEL_ | Undocumented | OTel SDK limit for the attribute count per log record and span. | A number | - |
OTEL_ | Documented | Sets the OTel limit for attribute value length. Claude Code caps content attributes at the smaller limit. | A number | - |
OTEL_ | Undocumented | OTel log record batch processor: export timeout in ms. | - | - |
OTEL_ | Undocumented | OTel log record batch processor: max records per export. | A number | - |
OTEL_ | Undocumented | OTel log record batch processor: queue size. | A number | - |
OTEL_ | Undocumented | OTel log record batch processor: delay between exports in ms. | - | - |
OTEL_ | Undocumented | OTel span batch processor: export timeout in ms. | - | - |
OTEL_ | Undocumented | OTel span batch processor: max spans per export. | A number | - |
OTEL_ | Undocumented | OTel span batch processor: queue size. | A number | - |
OTEL_ | Undocumented | OTel span batch processor: delay between exports in ms. | - | - |
OTEL_ | Documented | Gives the root CA file for the OTLP exporter. Signal-specific vars win. | - | - |
OTEL_ | Documented | Gives the client certificate file for OTLP mutual TLS. | - | - |
OTEL_ | Documented | Gives the client private key file for OTLP mutual TLS. | Text (a secret) | - |
OTEL_ | Undocumented | Sets OTLP compression. Signal-specific vars win. | - | - |
OTEL_ | Documented | Sets the OTLP collector endpoint for metrics, logs, and traces. | A URL | - |
OTEL_ | Documented | Sets extra OTLP request headers as key=value pairs. | - | - |
OTEL_ | Undocumented | Makes the gRPC OTLP exporter use an insecure channel when the value is true. | - | - |
OTEL_ | Undocumented | Gives the root CA file for the OTLP logs exporter. | - | - |
OTEL_ | Undocumented | Gives the client certificate file for the OTLP logs exporter. | - | - |
OTEL_ | Undocumented | Gives the client key file for the OTLP logs exporter. | Text (a secret) | - |
OTEL_ | Undocumented | Sets OTLP compression for logs only. | - | - |
OTEL_ | Documented | Sets the OTLP endpoint for logs only. | A URL | - |
OTEL_ | Documented | Sets OTLP headers for logs only. | - | - |
OTEL_ | Undocumented | Makes the gRPC OTLP logs exporter use an insecure channel when true. | - | - |
OTEL_ | Documented | Chooses the OTLP protocol for logs. Falls back to OTEL_. | - | - |
OTEL_ | Undocumented | Gives the root CA file for the OTLP metrics exporter. | - | - |
OTEL_ | Undocumented | Gives the client certificate file for the OTLP metrics exporter. | - | - |
OTEL_ | Documented | Gives the client key file for the OTLP metrics exporter. | Text (a secret) | - |
OTEL_ | Undocumented | Sets OTLP compression for metrics only. | - | - |
OTEL_ | Documented | Sets the OTLP endpoint for metrics only. | A URL | - |
OTEL_ | Documented | 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 | Allows an insecure (non-TLS) connection for the OTLP metrics exporter. | Text | Metrics exporter. Ignored in project and local env |
OTEL_ | Documented | 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 | Chooses delta or cumulative temporality for exported OTLP metrics. | Text. When unset, Claude Code sets it to delta at telemetry start (set by Claude Code) | Metrics exporter. Project env can set it before trust |
OTEL_ | Documented | 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 | 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 | 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 | 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 | 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 | Sets the compression of OTLP trace requests. | Text. Another value logs a warning and is ignored. Falls back to OTEL_ | Traces exporter. Project env can set it before trust |
OTEL_ | Documented Gated | 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 | Sets extra HTTP headers on the OTLP traces export. | Text. Overrides OTEL_ | Traces exporter. Ignored in project and local env |
OTEL_ | Undocumented | Allows an insecure (non-TLS) connection for the OTLP traces exporter. | Text | Traces exporter. Ignored in project and local env |
OTEL_ | Documented | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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. Integer, min 0, default unlimited. 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 | 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 | 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 | 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 | Chooses the exporters for OpenTelemetry metrics. | A comma-separated list. Needs CLAUDE_. In stream-json output mode console is removed | All entrypoints. Project settings may only set none. Ignored in project and local env |
OTEL_ | Documented | Adds the account UUID (and a tagged id) to metric attributes. | On or off, on by default. Any set value is parsed as bool, so only 1, true, yes, on keep it | Metrics. Project env can set it before trust |
OTEL_ | Documented | Adds the session entrypoint as app. to metric attributes. | On or off, off by default. Any set value is parsed as bool | Metrics. Project env can set it before trust |
OTEL_ | Documented | Adds vcs. repository attributes to metrics and events. | On or off, off by default. Any set value is parsed as bool | Metrics and events. Project env can set it before trust |
OTEL_ | Documented | Adds OTEL_ keys to metric attributes. | On or off, on by default. Any set value is parsed as bool. user. and identity. keys are skipped when the host supplies identity | Metrics. Project env can set it before trust |
OTEL_ | Documented | Adds session. (and the remote session id) to metric attributes. | On or off, on by default. Any set value is parsed as bool | Metrics. Project env can set it before trust |
OTEL_ | Documented | Adds the Claude Code version as app. to metric attributes. | On or off, off by default. Any set value is parsed as bool | Metrics. Project env can set it before trust |
OTEL_ | Documented | Adds custom resource attributes to telemetry, and to metric labels. | Text. Bad pairs are dropped | All entrypoints. Project env can set it before trust |
OTEL_ | Undocumented | Sets the service. resource attribute of exported telemetry. | Text | Telemetry. Project env can set it before trust |
OTEL_ | Undocumented | Limits the attributes on each span. | A number. Falls back to OTEL_, then 128 | Tracing. Not set from project env before trust |
OTEL_ | Undocumented | Limits the attributes on each span event. | A number, 128 by default | Tracing. Not set from project env before trust |
OTEL_ | Undocumented | Limits the attributes on each span link. | A number, 128 by default | Tracing. Not set from project env before trust |
OTEL_ | Documented | Limits the length of span attribute values. Also lowers the content cut-off. | A number, unlimited by default. Integer, min 0, default unlimited. 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 | Limits the events on each span. | A number, 128 by default | Tracing. Not set from project env before trust |
OTEL_ | Undocumented | Limits the links on each span. | A number, 128 by default | Tracing. Not set from project env before trust |
OTEL_ | Documented | 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 | Chooses the exporters for OpenTelemetry traces. | A comma-separated list. Needs telemetry and tracing on. In stream-json output mode console is removed | All entrypoints. Project settings may only set none. Ignored in project and local env |
OTEL_ | Undocumented | Chooses the trace sampler. | Text, parentbased_ by default | Tracing. Not set from project env before trust |
OTEL_ | Undocumented | 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 | 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 | 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 | 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 | 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 | 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 | Trace state that goes with TRACEPARENT. It is passed to the OTEL propagator. | Text. Only used when TRACEPARENT is set 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 relaunch.
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.
Related Pages
- Environment Variables: how Claude Code reads variables and which value wins.
- Monitoring (see the official docs)
- Undocumented Items: every item that only the program shows.
Source: the program (variable names found in the 2.1.304 binary) and the Environment Variables page of the official docs.