Skip to main content

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.

VariableStatusWhat it doesValues and defaultNotes
ANTHROPIC_LOG
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 levelBundled SDK client. Not set from project env before trust
BETA_TRACING_ENDPOINT
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 /v1/traces and /v1/logs.Text. Works only with ENABLE_BETA_TRACING_DETAILED set and when a second gate passesAll sessions. Docs say project and local settings ignore it
CCR_RUNNER_STARTUP_TIMING
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_CODE_REMOTE or CLAUDE_CODE_EMIT_STARTUP_TIMINGCloud remote and self-hosted runner sessions
CCR_SPAWN_TIMESTAMP_MS
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 parseInt, else ignored. The self-hosted runner sets itCloud remote and self-hosted runner sessions
CLAUDE_CODE_ACCOUNT_TAGGED_ID
Undocumented: Only the program shows this item. It can change without notice.
Overrides the user.account_id metric attribute.Text. Used only when OTEL_METRICS_INCLUDE_ACCOUNT_UUID is on and an account UUID exists. Else Claude Code derives a tagged idOTEL metrics. Not set from project env before trust
CLAUDE_CODE_ACTION
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 offGitHub Action runs. Not set from project env before trust
CLAUDE_CODE_AGENTS_MD_ROWS_EVERY_PROCESS
Undocumented: Only the program shows this item. It can change without notice.
Makes every non-interactive process send the AGENTS.md usage rows. Without it a stored usage-rows-queued note for the session keeps them from going out twice. Added in 2.1.311.On or off, off by default. An interactive session always sends them. Read by the module that loads AGENTS.md files when a project has no CLAUDE.mdNon-interactive sessions
CLAUDE_CODE_BENCH_LIVE_COUNTS
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 liveCountsEnabled on the rendererInteractive UI
CLAUDE_CODE_BYOC_ENABLE_DATADOG
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_CODE_ENVIRONMENT_KIND is byoc and this is unsetBYOC remote sessions
CLAUDE_CODE_CLASSIFIER_SUMMARY
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 heuristicAll sessions, gated by a feature flag
CLAUDE_CODE_DATADOG_FLUSH_INTERVAL_MS
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 defaultDatadog event logging
CLAUDE_CODE_DD_ERROR_TRACKING_FLUSH_INTERVAL_MS
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 defaultError reporting
CLAUDE_CODE_DEBUG_LOG_LEVEL
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 debugAll sessions
CLAUDE_CODE_DEBUG_LOGS_DIR
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-id>.txt to a learned directory.Text. Default ~/.claude/debug/<session-id>.txt. Debug mode must be onAll sessions
CLAUDE_CODE_DIAGNOSTICS_FILE
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 valueAll sessions, also forwarded to child processes
CLAUDE_CODE_DISABLE_OTEL_EVENT_SKIP
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.1.311.On or off, off by defaultAll sessions
CLAUDE_CODE_DISABLE_VITALS_EMITTER
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 disabledGuest and container sessions
CLAUDE_CODE_EMIT_STARTUP_TIMING
Undocumented: Only the program shows this item. It can change without notice.
Turns on collection and reporting of startup timing phases, as CLAUDE_CODE_REMOTE does.On or off, off by default. Reported fields include the entrypoint valueAll sessions
CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL
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 checkAll sessions. Project env can set it before trust
CLAUDE_CODE_ENABLE_SHARE_BUNDLE
Undocumented: Only the program shows this item. It can change without notice.
Makes /share send the whole transcript as a feedback bundle.On or off, off by default. Used in the /share command pathFirst-party sessions
CLAUDE_CODE_ENABLE_TELEMETRY
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 noneAll sessions. Project env can set it before trust
CLAUDE_CODE_ENHANCED_TELEMETRY_BETA
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_TRACES_EXPORTER=otlp. ENABLE_ENHANCED_TELEMETRY_BETA 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 offAll sessions
CLAUDE_CODE_FRAME_TIMING_LOG
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 defaultInteractive terminal UI
CLAUDE_CODE_FRAME_TIMING_SAMPLE_EVERY
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_CODE_FRAME_TIMING_LOGInteractive terminal UI
CLAUDE_CODE_GB_DISK_CACHE_WHEN_TELEMETRY_OFF
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_GROWTHBOOK unsetFirst-party sessions
CLAUDE_CODE_HOST_PLATFORM
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 hostPlatform in a policy facts objectAll sessions
CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH
Documented: An official docs page names this item.
Caps the length of content-bearing OpenTelemetry attributes. Truncated text gets a [TRUNCATED - Content exceeds ...] 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_*_ATTRIBUTE_VALUE_LENGTH_LIMIT varsAll sessions, when OTEL content logging is on
CLAUDE_CODE_OTEL_DIAG_STDERR
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 subprocessesAll sessions
CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS
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 valueAll sessions, when OTEL is on
CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS
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 1740000All sessions, when an OTEL headers helper is set
CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS
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 msAll sessions, when OTEL is on
CLAUDE_CODE_PERFETTO_TRACE
Undocumented: Only the program shows this item. It can change without notice.
The only read site logs [Perfetto] initializePerfettoTracing called, env value: to the debug log. In a test with 2.1.305, with a value of 1, a file path, and a folder path, in -p (also with CLAUDE_CODE_PERFETTO_WRITE_INTERVAL_S=1), no trace file was written anywhere. A test in the interactive screen on 2.1.305 (a pty, one turn answered, the same three values with CLAUDE_CODE_PERFETTO_WRITE_INTERVAL_S=1) also wrote none (Probes).Text. Any value only reaches that debug lineAll sessions
CLAUDE_CODE_PROFILE_QUERY
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 enabledAll sessions
CLAUDE_CODE_PROFILE_STARTUP
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 reportAll sessions
CLAUDE_CODE_PROPAGATE_TRACEPARENT
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 valueAll sessions
CLAUDE_CODE_SESSION_LOG
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 logPath in the recordConcurrent-session registry
CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS
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.stringify.A number of milliseconds. The default is no limit (Infinity)All sessions
CLAUDE_CODE_SPAWN_TIMESTAMP_MS
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_SPAWN_TIMESTAMP_MS firstHeadless and print mode
CLAUDE_CODE_TAGS
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.TextAll sessions
CLAUDE_CODE_TRIGGER_ID
Undocumented: Only the program shows this item. It can change without notice.
Passes a trigger ID into a feature flag event as trigger_id.Text. No other effect seenAll sessions
CLAUDE_CODE_WORKSPACE_HOST_PATHS
Undocumented: Only the program shows this item. It can change without notice.
Adds host paths to each event as workspace.host_paths.Text. Split on the pipe character into a listHosted workspaces
CLAUDE_DEBUG
Undocumented: Only the program shows this item. It can change without notice.
Logs Node process warnings to the debug log.On or offAll sessions
CLAUDE_PTY_RECORD
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_CLAUDE_AGENT_SDK
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_SDK
Undocumented: Only the program shows this item. It can change without notice.
Turns on debug mode at start.--
DISABLE_ERROR_REPORTING
Documented: An official docs page names this item.
Opts out of error reporting.On or off-
DISABLE_TELEMETRY
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 sessionsAll sessions. Not set from project env before trust
DO_NOT_TRACK
Documented: An official docs page names this item.
Opts out of telemetry like DISABLE_TELEMETRY does.On or off. Claude Code parses it as a standard boolean, so 0 or false leaves telemetry onAll sessions. Not set from project env before trust
ENABLE_BETA_TRACING_DETAILED
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_TRACING_ENDPOINT as well.On or off. Also needs a non-empty BETA_TRACING_ENDPOINT. Gated by an org check or a feature flagTracing. Not set from project env before trust
ENABLE_ENHANCED_TELEMETRY_BETA
Documented: An official docs page names this item.
Turns on enhanced telemetry tracing. It is the fallback name of CLAUDE_CODE_ENHANCED_TELEMETRY_BETA.On or off. Truthy values enable it. Claude Code reads the CLAUDE_CODE_ name first with ??Tracing. Not set from project env before trust
GITHUB_ACTION_INPUTS
Undocumented: Only the program shows this item. It can change without notice.
Passes the action inputs to a startup telemetry field named githubActionInputs.TextGitHub Actions. Not set from project env before trust
GITHUB_ACTOR_ID
Undocumented: Only the program shows this item. It can change without notice.
Sends the actor id as telemetry metadata when GITHUB_ACTIONS is on.TextGitHub Actions. Not set from project env before trust
GITHUB_EVENT_NAME
Undocumented: Only the program shows this item. It can change without notice.
Sends the event name as telemetry metadata when GITHUB_ACTIONS is on.TextGitHub Actions. Not set from project env before trust
GITHUB_REPOSITORY
Undocumented: Only the program shows this item. It can change without notice.
Sends the repository name as telemetry metadata when GITHUB_ACTIONS is on.TextGitHub Actions. Not set from project env before trust
GITHUB_REPOSITORY_ID
Undocumented: Only the program shows this item. It can change without notice.
Sends the repository id as telemetry metadata when GITHUB_ACTIONS is on.TextGitHub Actions. Not set from project env before trust
GITHUB_REPOSITORY_OWNER
Undocumented: Only the program shows this item. It can change without notice.
Sends the repository owner as telemetry metadata when GITHUB_ACTIONS is on.TextGitHub Actions. Not set from project env before trust
GITHUB_REPOSITORY_OWNER_ID
Undocumented: Only the program shows this item. It can change without notice.
Sends the repository owner id as telemetry metadata when GITHUB_ACTIONS is on.TextGitHub Actions. Not set from project env before trust
GOOGLE_SDK_NODE_LOGGING
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 offGoogle auth library
OTEL_ATTRIBUTE_COUNT_LIMIT
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_ATTRIBUTE_VALUE_LENGTH_LIMIT
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_BLRP_EXPORT_TIMEOUT
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_BLRP_MAX_EXPORT_BATCH_SIZE
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_BLRP_MAX_QUEUE_SIZE
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_BLRP_SCHEDULE_DELAY
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_BSP_EXPORT_TIMEOUT
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_BSP_MAX_EXPORT_BATCH_SIZE
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_BSP_MAX_QUEUE_SIZE
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_BSP_SCHEDULE_DELAY
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_EXPORTER_OTLP_CERTIFICATE
Documented: An official docs page names this item.
Gives the root CA file for the OTLP exporter. Signal-specific vars win.--
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE
Documented: An official docs page names this item.
Gives the client certificate file for OTLP mutual TLS.--
OTEL_EXPORTER_OTLP_CLIENT_KEY
Documented: An official docs page names this item.
Gives the client private key file for OTLP mutual TLS.Text (a secret)-
OTEL_EXPORTER_OTLP_COMPRESSION
Undocumented: Only the program shows this item. It can change without notice.
Sets OTLP compression. Signal-specific vars win.--
OTEL_EXPORTER_OTLP_ENDPOINT
Documented: An official docs page names this item.
Sets the OTLP collector endpoint for metrics, logs, and traces.A URL-
OTEL_EXPORTER_OTLP_HEADERS
Documented: An official docs page names this item.
Sets extra OTLP request headers as key=value pairs.--
OTEL_EXPORTER_OTLP_INSECURE
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_EXPORTER_OTLP_LOGS_CERTIFICATE
Undocumented: Only the program shows this item. It can change without notice.
Gives the root CA file for the OTLP logs exporter.--
OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE
Undocumented: Only the program shows this item. It can change without notice.
Gives the client certificate file for the OTLP logs exporter.--
OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY
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_EXPORTER_OTLP_LOGS_COMPRESSION
Undocumented: Only the program shows this item. It can change without notice.
Sets OTLP compression for logs only.--
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
Documented: An official docs page names this item.
Sets the OTLP endpoint for logs only.A URL-
OTEL_EXPORTER_OTLP_LOGS_HEADERS
Documented: An official docs page names this item.
Sets OTLP headers for logs only.--
OTEL_EXPORTER_OTLP_LOGS_INSECURE
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_EXPORTER_OTLP_LOGS_PROTOCOL
Documented: An official docs page names this item.
Chooses the OTLP protocol for logs. Falls back to OTEL_EXPORTER_OTLP_PROTOCOL.--
OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE
Undocumented: Only the program shows this item. It can change without notice.
Gives the root CA file for the OTLP metrics exporter.--
OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE
Undocumented: Only the program shows this item. It can change without notice.
Gives the client certificate file for the OTLP metrics exporter.--
OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY
Documented: An official docs page names this item.
Gives the client key file for the OTLP metrics exporter.Text (a secret)-
OTEL_EXPORTER_OTLP_METRICS_COMPRESSION
Undocumented: Only the program shows this item. It can change without notice.
Sets OTLP compression for metrics only.--
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
Documented: An official docs page names this item.
Sets the OTLP endpoint for metrics only.A URL-
OTEL_EXPORTER_OTLP_METRICS_HEADERS
Documented: An official docs page names this item.
Sets extra HTTP headers on the OTLP metrics export.Text. Overrides OTEL_EXPORTER_OTLP_HEADERSMetrics exporter with http/json, http/protobuf or grpc. Ignored in project and local env
OTEL_EXPORTER_OTLP_METRICS_INSECURE
Undocumented: Only the program shows this item. It can change without notice.
Allows an insecure (non-TLS) connection for the OTLP metrics exporter.TextMetrics exporter. Ignored in project and local env
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL
Documented: An official docs page names this item.
Picks the OTLP wire protocol for metrics. Falls back to OTEL_EXPORTER_OTLP_PROTOCOL.Text. Another value throws an Unknown protocol errorMetrics exporter when OTEL_METRICS_EXPORTER has otlp. Ignored in project and local env
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
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 startMetrics exporter. Project env can set it before trust
OTEL_EXPORTER_OTLP_PROTOCOL
Documented: An official docs page names this item.
Sets the default OTLP wire protocol for metrics, logs and traces.Text. A per-signal ..._PROTOCOL winsTelemetry exporters with otlp. Ignored in project and local env
OTEL_EXPORTER_OTLP_TIMEOUT
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_EXPORTER_OTLP_<SIGNAL>_TIMEOUT wins. A bad value logs a warningOTLP exporters. Not set from project env before trust
OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE
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_EXPORTER_OTLP_CERTIFICATE. A read failure logs a warningTraces exporter. Ignored in project and local env
OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE
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_EXPORTER_OTLP_CLIENT_CERTIFICATE. Needs the matching client keyTraces exporter. Ignored in project and local env
OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY
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_EXPORTER_OTLP_CLIENT_KEY. Needs the matching client certificateTraces exporter. Ignored in project and local env
OTEL_EXPORTER_OTLP_TRACES_COMPRESSION
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_EXPORTER_OTLP_COMPRESSIONTraces exporter. Project env can set it before trust
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
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/protobuf for traces.Text. The remote check needs https or localhost http, no credentials, no query, and a path that ends in tracesTraces exporter. Remote check needs CLAUDE_CODE_REMOTE. Not set from project env before trust
OTEL_EXPORTER_OTLP_TRACES_HEADERS
Documented: An official docs page names this item.
Sets extra HTTP headers on the OTLP traces export.Text. Overrides OTEL_EXPORTER_OTLP_HEADERSTraces exporter. Ignored in project and local env
OTEL_EXPORTER_OTLP_TRACES_INSECURE
Undocumented: Only the program shows this item. It can change without notice.
Allows an insecure (non-TLS) connection for the OTLP traces exporter.TextTraces exporter. Ignored in project and local env
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
Documented: An official docs page names this item.
Picks the OTLP wire protocol for traces. Falls back to OTEL_EXPORTER_OTLP_PROTOCOL.Text. A valid remote OTEL_EXPORTER_OTLP_TRACES_ENDPOINT forces http/protobufTraces exporter when OTEL_TRACES_EXPORTER has otlp. Ignored in project and local env
OTEL_EXPORTER_PROMETHEUS_HOST
Documented: An official docs page names this item.
Sets the host that the Prometheus metrics exporter binds to.Falls back to the SDK defaultMetrics exporter with prometheus. Ignored in project and local env
OTEL_EXPORTER_PROMETHEUS_PORT
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 portMetrics exporter with prometheus. Ignored in project and local env
OTEL_LOG_ASSISTANT_RESPONSES
Documented: An official docs page names this item.
Includes the model response text in assistant_response log events.On, off, or unset. When unset, the value of OTEL_LOG_USER_PROMPTS applies. 0 keeps responses redactedAll entrypoints. Ignored in project and local env. Project env may set only an off value
OTEL_LOG_MANAGED_SETTINGS
Documented: An official docs page names this item.
Adds redacted managed settings and a SHA-256 digest to managed_settings_resolved events.On or off. Reads managed and user layers first, and skips project and local scopesAll entrypoints. Ignored in project and local env
OTEL_LOG_RAW_API_BODIES
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:<dir> writes full bodies to disk with a body_refAll entrypoints, not diskless hosts. Ignored in project and local env
OTEL_LOG_TOOL_CONTENT
Documented: An official docs page names this item.
Includes tool content in the tool.output span event.On or off. Needs tracing onAll entrypoints with tracing. Ignored in project and local env. Project env may set only an off value
OTEL_LOG_TOOL_DETAILS
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_category on tool_decision eventsAll entrypoints. Ignored in project and local env. Project env may set only an off value
OTEL_LOG_USER_PROMPTS
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_LOGRECORD_ATTRIBUTE_COUNT_LIMIT
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_ATTRIBUTE_COUNT_LIMIT, then 128Log exporters. Not set from project env before trust
OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT
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_CODE_OTEL_CONTENT_MAX_LENGTH (61440)Log exporters and OTEL content fields. Not set from project env before trust
OTEL_LOGS_EXPORT_INTERVAL
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_LOGS_EXPORTER
Documented: An official docs page names this item.
Chooses the exporters for OpenTelemetry log events.A comma-separated list. Needs CLAUDE_CODE_ENABLE_TELEMETRY. In stream-json output mode Claude Code removes console from itAll entrypoints. Project settings may only set none. Ignored in project and local env
OTEL_METRIC_EXPORT_INTERVAL
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. IntegerMetrics exporters. Project env can set it before trust
OTEL_METRICS_EXPORTER
Documented: An official docs page names this item.
Chooses the exporters for OpenTelemetry metrics.A comma-separated list. Needs CLAUDE_CODE_ENABLE_TELEMETRY. In stream-json output mode, Claude Code removes consoleAll entrypoints. Project settings may only set none. Ignored in project and local env
OTEL_METRICS_INCLUDE_ACCOUNT_UUID
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 itMetrics. Project env can set it before trust
OTEL_METRICS_INCLUDE_ENTRYPOINT
Documented: An official docs page names this item.
Adds the session entrypoint as app.entrypoint to metric attributes.On or off, off by default. Claude Code parses any set value as a booleanMetrics. Project env can set it before trust
OTEL_METRICS_INCLUDE_REPOSITORY
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 booleanMetrics and events. Project env can set it before trust
OTEL_METRICS_INCLUDE_RESOURCE_ATTRIBUTES
Documented: An official docs page names this item.
Adds OTEL_RESOURCE_ATTRIBUTES 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 identityMetrics. Project env can set it before trust
OTEL_METRICS_INCLUDE_SESSION_ID
Documented: An official docs page names this item.
Adds session.id (and the remote session id) to metric attributes.On or off, on by default. Claude Code parses any set value as a booleanMetrics. Project env can set it before trust
OTEL_METRICS_INCLUDE_VERSION
Documented: An official docs page names this item.
Adds the Claude Code version as app.version to metric attributes.On or off, off by default. Claude Code parses any set value as a booleanMetrics. Project env can set it before trust
OTEL_RESOURCE_ATTRIBUTES
Documented: An official docs page names this item.
Adds custom resource attributes to telemetry, and to metric labels.Text. Claude Code drops bad pairsAll entrypoints. Project env can set it before trust
OTEL_SERVICE_NAME
Undocumented: Only the program shows this item. It can change without notice.
Sets the service.name resource attribute of exported telemetry.TextTelemetry. Project env can set it before trust
OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT
Undocumented: Only the program shows this item. It can change without notice.
Limits the attributes on each span.A number. Falls back to OTEL_ATTRIBUTE_COUNT_LIMIT, then 128Tracing. Not set from project env before trust
OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT
Undocumented: Only the program shows this item. It can change without notice.
Limits the attributes on each span event.A number, 128 by defaultTracing. Not set from project env before trust
OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT
Undocumented: Only the program shows this item. It can change without notice.
Limits the attributes on each span link.A number, 128 by defaultTracing. Not set from project env before trust
OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT
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_CODE_OTEL_CONTENT_MAX_LENGTHTracing and OTEL content fields. Not set from project env before trust
OTEL_SPAN_EVENT_COUNT_LIMIT
Undocumented: Only the program shows this item. It can change without notice.
Limits the events on each span.A number, 128 by defaultTracing. Not set from project env before trust
OTEL_SPAN_LINK_COUNT_LIMIT
Undocumented: Only the program shows this item. It can change without notice.
Limits the links on each span.A number, 128 by defaultTracing. Not set from project env before trust
OTEL_TRACES_EXPORT_INTERVAL
Documented: An official docs page names this item.
Sets the trace batch export delay in ms.A number, 5000 by default. IntegerTraces exporters. Project env can set it before trust
OTEL_TRACES_EXPORTER
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 consoleAll entrypoints. Project settings may only set none. Ignored in project and local env
OTEL_TRACES_SAMPLER
Undocumented: Only the program shows this item. It can change without notice.
Chooses the trace sampler.Text, parentbased_always_on by defaultTracing. Not set from project env before trust
OTEL_TRACES_SAMPLER_ARG
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 1Tracing with a ratio sampler. Not set from project env before trust
SRT_DEBUG
Undocumented: Only the program shows this item. It can change without notice.
Turns on [SandboxDebug] log lines in the bundled sandbox runtime.Any non-empty value turns it on. Level picks console.error, console.warn, or logSandbox runtime
SWE_BENCH_INSTANCE_ID
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 (sweBenchInstanceId)All sessions, telemetry only
SWE_BENCH_RUN_ID
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 (sweBenchRunId)All sessions, telemetry only
SWE_BENCH_TASK_ID
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 (sweBenchTaskId)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 onAll 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 onAll 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.

Source: the program (variable names found in the 2.1.312 binary) and the Environment Variables page of the official docs.