Skip to content

Telemetry and tracing

This page owns the traffic, telemetry, analytics, and tracing/export side of the ops layer. It separates observability transport from local debug logs and from feature-gate decision logic.

Use Diagnostics and debug logs for local debug evidence, Feature gates reference for GrowthBook/tengu_* feature gates, and Environment variables reference for the canonical env-var list.

Source anchors

Semantic aliasSourceApproximate locationString or symbolMeaning
EssentialTrafficGatecli.jsline ~133, byte 0xea146CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICCoarse traffic gate: essential traffic only.
DisableTelemetryGatecli.jsline ~133, byte 0xea198DISABLE_TELEMETRYTelemetry disable gate.
DoNotTrackGatecli.jsline ~133, byte 0xea1d1DO_NOT_TRACKTelemetry disable gate.
DisableErrorReportingGatecli.jsline ~133, byte 0xea692DISABLE_ERROR_REPORTINGError-reporting disable gate.
OtelHeadersEnvcli.jsline ~2630, byte 0x654a73OTEL_EXPORTER_OTLP_HEADERSOpenTelemetry exporter env surface.
TraceExportPathcli.jsline ~2709, byte 0x72d66f/v1/tracesBeta/OTEL trace export path.
LogExportPathcli.jsline ~2709, byte 0x72d69c/v1/logsBeta/OTEL log export path.
TraceparentEnvcli.jsline ~2027, byte 0x526c31TRACEPARENTTrace-context propagation.
AnalyticsFlushHookcli.jsline ~1676, byte 0x4fb763flushAnalyticsSinksShutdown-time analytics/log/trace flush.

Traffic policy

The traffic gate visible near line ~133 distinguishes coarse network policy from telemetry-specific disablement.

ConditionRuntime traffic mode
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC is setessential-traffic
DISABLE_TELEMETRY is setno-telemetry
DO_NOT_TRACK is truthyno-telemetry
none of the abovedefault

This distinction matters because essential traffic can still allow network calls required for core operation, while telemetry/error-reporting sinks are reduced or disabled.

Telemetry signal families

cli.js contains many tengu_* strings. In this wiki, they are treated as operational signal names unless surrounding source confirms a product behavior. Common families include:

FamilyExamplesInterpretation
Tool/securitytengu_tool_use_can_use_tool_allowed, tengu_tool_use_can_use_tool_rejectedTool permission outcomes and security decisions.
MCP/pluginstengu_mcp_tool_call_auth_error, plugin install/update signalsIntegration health and auth failures.
Agents/schedulingscheduled-task, auto-mode, background-agent signalsAgent/task runtime observability.
Remote/bridgebridge state, remote backend, CCR-style signalsRemote Control and bridge operation.
Updatertengu_native_auto_updater_*Native updater lifecycle.
API/model usageAPI request duration, token, cost, retry, and quota signalsProvider-call accounting and support evidence.

OpenTelemetry and trace export

SurfaceRole
TRACEPARENT, TRACESTATEW3C trace-context propagation into subprocess/session env when available.
BETA_TRACING_ENDPOINTIf set, beta exporter delegates to ${endpoint}/v1/traces and ${endpoint}/v1/logs.
OTEL_EXPORTER_OTLP_ENDPOINTStandard OTLP endpoint.
OTEL_EXPORTER_OTLP_PROTOCOL and per-signal protocol envsSelects grpc, http/json, or http/protobuf exporters.
OTEL_EXPORTER_OTLP_HEADERSHeader configuration for OTLP export.
OTEL_METRICS_EXPORTER, OTEL_LOGS_EXPORTERSelects metrics/log exporters such as console, OTLP, or prometheus.
OTEL_LOG_TOOL_DETAILS, OTEL_LOG_TOOL_CONTENT, OTEL_LOG_USER_PROMPTSControls how much tool/user detail can be logged.
--add-trace-attribute key=valueAdds runtime trace attributes.

The source installs final flush hooks on exit paths, so logs/traces get a best-effort drain during shutdown.

Error reporting

Error reporting is controlled separately from telemetry. DISABLE_ERROR_REPORTING, provider-specific modes, and essential-traffic mode can short-circuit external error reporting even when local debug logs exist.

Safe interpretation rules

  1. Treat tengu_* as evidence of telemetry or a feature gate, not as a stable public event schema.
  2. Do not infer live network behavior from static endpoint strings alone.
  3. Keep sensitive values out of logs; env-var names can be documented, values should not be captured.
  4. Use Diagnostics and debug logs for file/stdout/stderr debug evidence.

Created and maintained by Yingting Huang.