Skip to content

Telemetry is implemented in packages/core/src/telemetry/. It is off unless enabled — the settings default is undefined and the SDK exits early when telemetry is disabled.

Settings ​

The telemetry settings object accepts:

KeyMeaning
enabledMaster switch.
tracesEnable trace export.
targetlocal or gcp.
otlpEndpointCollector endpoint; defaults to http://localhost:4317.
otlpProtocolgrpc or http.
otlpHeadersHeaders for the collector.
logPromptsInclude prompt text and tool arguments in telemetry.
outfileAppend telemetry as JSON to a local file.
useCollectorUse a collector pipeline.
useCliAuthUse CLI credentials for telemetry auth.
json
{
  "telemetry": {
    "enabled": true,
    "target": "local",
    "otlpProtocol": "grpc"
  },
  "privacy": {"usageStatisticsEnabled": false}
}

Environment variables ​

The telemetry config uses an allow-list of variables:

  • M31A_TELEMETRY_ENABLED
  • M31A_TELEMETRY_TRACES_ENABLED
  • M31A_TELEMETRY_TARGET
  • M31A_TELEMETRY_OTLP_ENDPOINT
  • M31A_TELEMETRY_OTLP_PROTOCOL
  • M31A_TELEMETRY_OTLP_HEADERS
  • M31A_TELEMETRY_LOG_PROMPTS
  • M31A_TELEMETRY_OUTFILE
  • M31A_TELEMETRY_USE_COLLECTOR
  • M31A_TELEMETRY_USE_CLI_AUTH
  • OTEL_EXPORTER_OTLP_ENDPOINT
  • OTEL_EXPORTER_OTLP_HEADERS

Boolean values are true only for true or 1. Invalid target or protocol values are configuration errors. Related variables include M31A_STRICT_TELEMETRY_LIMITS, M31A_MEMORY_MONITOR_INTERVAL, and M31A_EVENT_LOOP_MONITOR_ENABLED.

Precedence ​

Highest to lowest: CLI arguments → environment → settings. Exceptions: traces, useCollector, and useCliAuth have no CLI-argument override. Headers are merged from settings, OTEL_EXPORTER_OTLP_HEADERS, M31A_TELEMETRY_OTLP_HEADERS, and CLI arguments.

Exporters ​

  • Valid endpoint and no outfile — OTLP export over gRPC or HTTP.
  • outfile set — JSON append exporters to a local file.
  • Neither — console exporters.

Metric export uses a 10-second interval.

Privacy ​

  • Prompt text and tool arguments are emitted only when logPrompts is true. Otherwise the recorded prompt body is a length-only message.
  • Event names cover configuration, user prompts, tool calls, API requests, errors and responses, compression, rewind, slash commands, model routing, approval mode, hooks, and agent lifecycle.
  • Keep logPrompts unset for sensitive work, and use security.environmentVariableRedaction to protect secrets from logs and exported sessions.

Next steps ​

See Settings, Environment variables, and Security.

Built with VitePress. Powered by NVIDIA NIM.