Telemetry
$.telemetry logs analytics records.
Only a call from Claude Code or a built-in mod sends a record.
A mod you install can watch and rewrite records, but it must give its telemetry hook the filter { to: 'collector' }.
Without the filter the mod fails claude plugin validate. * does not select these events.
A hook can return { deny }. The built-in cc-plugin-telemetry sends the records. The collector is the one the operator of the session configured.
Official page: Mods Reference. Source: the Mod API type file of the 2.1.312 program (schemas/claude-code.d.ts).
Example
on("telemetry.log", { to: "collector" }, ($, e, next) => next(e));
Members
| Item | Status | What it does | How it works | Where it can be used |
|---|---|---|---|---|
$. | Documented: An official docs page names this item. | Logs one record to the destination entry. names. It is the event telemetry.. anthropic is the default. | (entry:. Sends a first-party row or a collector record. The engine queues a first-party row for built-ins only. Rejects if a hook denies. | Only built-ins and the engine make records that Claude Code sends. |
$. | Documented: An official docs page names this item. | Marks one use of a feature, as the CLI's own feature events do. It takes no to and always means anthropic. | (entry:. The engine does nothing with it. Built-in plugins that hook the event queue the row. | Only built-ins and the engine make records that Claude Code sends. |
Engine Events
| Item | Status | What it does | How it works | Where it can be used |
|---|---|---|---|---|
telemetry. | Documented: An official docs page names this item. | Fires when a record is about to be logged to the destination e. names. | Input Telemetry. Result { value: or { deny }. The type pins e.. | on('telemetry.. Also $.. |
telemetry. | Documented: An official docs page names this item. | Fires when a caller marks one use of a feature. It always goes to anthropic, with no to. | Input Telemetry. Result { value: or { deny }. { deny } rejects the caller. | on('telemetry.. Also $.. |
Types
| Item | Status | What it is for | Shape and limits |
|---|---|---|---|
Telemetry | Documented: An official docs page names this item. | One attribute of a collector record. | string | number | boolean | readonly string[] |
Telemetry | Documented: An official docs page names this item. | A string property of a first-party row: the value and the list it is chosen from, so no free text reaches a row. | Fields value and of. Every member of of is a lowercase token of letters, digits, _, and -. At most 32 members. value is one of them. |
Telemetry | Documented: An official docs page names this item. | Where a record goes. | 'anthropic' (first-party analytics) or 'collector' (the one the operator configured). |
Telemetry | Documented: An official docs page names this item. | What a call of $. passes. | Telemetry |
Telemetry | Documented: An official docs page names this item. | The input of telemetry.. to is always present. The type pins it. | Telemetry |
Telemetry, Telemetry | Documented: An official docs page names this item. | What a hook returns and next(e) resolves to. | { value:, or { deny }, which rejects the caller's promise. |
Telemetry | Documented: An official docs page names this item. | The input of telemetry.. | feature (snake_case name), kind (Telemetry), reason? (a short token), props? (Readonly<Record<string, Telemetry). |
Telemetry | Documented: An official docs page names this item. | How one use of a feature went. | 'ok' (the person got what they asked), 'sad' (degraded, they still got something), 'bad' (failed, they got nothing). |
Telemetry | Documented: An official docs page names this item. | One property of a first-party row or a mark. | number | boolean | Telemetry |
Telemetry | Documented: An official docs page names this item. | A record for the collector the operator configured. | to ('collector', pinned), event (leaves as claude_), attributes (go out as they stand), logged (ISO 8601 to the millisecond), span? (Telemetry). |
Telemetry | Documented: An official docs page names this item. | A first-party row as a call passes it. | to? ('anthropic'), event, props?. |
Telemetry | Documented: An official docs page names this item. | A first-party row as a hook reads it. to is always present. | to ('anthropic', pinned), event, props?. |
Telemetry | Documented: An official docs page names this item. | The span a collector record belongs to, in W3C trace context spelling. | trace (32 hex digits), span (16 hex digits), trace (bit 0 set when the trace is sampled). |