OpenTelemetry Events
Claude Code can send log events to an OpenTelemetry (OTEL) collector. This page lists the 28 events that the program emits and the attributes each one carries. The variables that turn telemetry on and set the exporters are on Telemetry and Debug.
Events
Source: the program. The attribute names come from the call sites of the event emitter, read into claude-code-otel.json.
A key that some call sites leave out may be missing from an event. So treat every attribute as optional.
The schema has the type of each attribute. The program sends some numbers as strings. So look a field up there before you rely on its type.
Only tool_decision is marked
| Event | Status | What It Records | Attributes |
|---|---|---|---|
api_ | Undocumented: Only the program shows this item. It can change without notice. | An API request failed. | model, error, status_, duration_, attempt, request_, client_, speed, query_, effort, agent., skill., plugin., marketplace., mcp_, mcp_ |
api_ | Undocumented: Only the program shows this item. It can change without notice. | The API refused a request. | model, request_, speed, attempt, server_, query_, effort, has_, has_, category, agent., skill., plugin., marketplace., mcp_, mcp_ |
api_ | Undocumented: Only the program shows this item. It can change without notice. | An API request finished, with token counts, cost, and timing. | model, input_, output_, cache_, cache_, cache_, cache_, cost_, cost_, duration_, ttft_, request_, client_, speed, query_, effort, agent., skill., plugin., marketplace., mcp_, mcp_ |
api_ | Undocumented: Only the program shows this item. It can change without notice. | An API request used all its retries. | model, error, status_, total_, total_, speed, query_, effort |
assistant_ | Undocumented: Only the program shows this item. It can change without notice. | A model response. The text is in response only when OTEL_ or OTEL_ allows it. | response_, response, request_, message., model, query_ |
at_ | Undocumented: Only the program shows this item. It can change without notice. | An @ mention was used. | mention_, success |
auth | Undocumented: Only the program shows this item. It can change without notice. | An auth action ran. | action, success, auth_, error_, status_ |
compaction | Undocumented: Only the program shows this item. It can change without notice. | A context compaction ran. | trigger, success, duration_, pre_, post_, error, precompute_ |
feedback_ | Undocumented: Only the program shows this item. It can change without notice. | A step of the session quality survey. | event_, appearance_, response, survey_, enabled_, event_, event_, trigger_, plugin_, plugin. |
hook_ | Undocumented: Only the program shows this item. It can change without notice. | The hooks of one hook event finished. | hook_, hook_, num_, num_, num_, num_, num_, total_, stdout_, additional_, system_, initial_, num_, managed_, hook_, safe_, hook_ |
hook_ | Undocumented: Only the program shows this item. It can change without notice. | The hooks of one hook event started. | hook_, hook_, num_, managed_, hook_, safe_, hook_ |
hook_ | Undocumented: Only the program shows this item. It can change without notice. | A hook event of a plugin. | plugin_, hook_ |
hook_ | Undocumented: Only the program shows this item. It can change without notice. | A hook was registered. | hook_, hook_, hook_, safe_, hook_, plugin., plugin_ |
internal_ | Undocumented: Only the program shows this item. It can change without notice. | An internal error, with its name and code. | error_, error_ |
managed_ | Undocumented: Only the program shows this item. It can change without notice. | Managed settings were resolved. OTEL_ adds the redacted settings. | managed_, managed_, managed_, managed_, managed_, managed_, managed_, managed_, managed_, managed_, managed_, error. |
mcp_ | Undocumented: Only the program shows this item. It can change without notice. | The result of an MCP server connection. | status, transport_, server_, duration_, is_, plugin_, plugin., error_, server_, error |
permission_ | Undocumented: Only the program shows this item. It can change without notice. | The permission mode changed. | from_, to_, trigger |
plugin_ | Undocumented: Only the program shows this item. It can change without notice. | A plugin was installed. | plugin., plugin., marketplace., marketplace., install., install. |
plugin_ | Undocumented: Only the program shows this item. It can change without notice. | A plugin was loaded. | plugin., marketplace., plugin., plugin., enabled_, plugin_, has_, has_, host_, skill_, command_, agent_, safe_ |
retention_ | Undocumented: Only the program shows this item. It can change without notice. | A cleanup of old session data ran, with counts. | result, period_, used_, skip_, transcripts_, transcripts_, session_, artifacts_, files_, files_, error_, history_ |
safety_ | Gated: Works only behind a flag or a server gate. Server flag tengu_snoopy_creek, off by default since 2.1.312 | A permission or safety decision. Off by default since 2., because the server-side gate tengu_ now defaults to false. In 2. it defaulted to true. The code that sends the event is still in the program, and both of its call sites test the gate, so a server-side flag can turn the event on again. | category, decision, decision_, reason_, reason_, rule_, grant_, circuit_, classifier_, hook_, tool_, tool_, tool_, permission_, tool_, sandbox_, sandbox_ |
skill_ | Undocumented: Only the program shows this item. It can change without notice. | A skill was activated. | skill., invocation_, skill., skill., plugin., marketplace. |
subagent_ | Undocumented: Only the program shows this item. It can change without notice. | A subagent finished, with token and tool-use counts. | agent_, agent., is_, is_, total_, total_, duration_, model, final_, model_, plugin_, plugin. |
system_ | Undocumented: Only the program shows this item. It can change without notice. | The system prompt, or its hash. | system_, system_, system_, system_ |
tool | Undocumented: Only the program shows this item. It can change without notice. | A tool definition, or its hash. | tool_, tool_, tool, tool_ |
tool_ | Documented: An official docs page names this item. | A tool use was accepted or rejected. OTEL_ adds classifier_. | decision, source, tool_, tool_, tool_, tool_, classifier_, classifier_, permission_ |
tool_ | Undocumented: Only the program shows this item. It can change without notice. | A tool call finished. After a git commit it also carries the vcs. fields. | tool_, tool_, success, duration_, tool_, tool_, tool_, tool_, decision_, decision_, mcp_, vcs., vcs., vcs., error_, error |
user_ | Undocumented: Only the program shows this item. It can change without notice. | A user prompt. The text is in prompt only when OTEL_ is on. | prompt_, prompt, prompt_ |
What Two Attributes Report
| Attribute | Status | What It Reports | Notes |
|---|---|---|---|
effort | Undocumented: Only the program shows this item. It can change without notice. | The effort level in force for the request. | Since 2.. Before, it could name a newly picked level before the model applied it. The program takes the level from the last effort change that the conversation holds, and uses the new pick only when there is none. The api_ event reads it from output_ of the request, and the refusal path passes the same level. We did not trace api_ and api_ one by one. |
mcp_ | Undocumented: Only the program shows this item. It can change without notice. | The server name. For most servers that a plugin declares it reports custom. | Since 2., it reports the real name for a remote MCP server with a fixed URL of type http, sse, or ws that a plugin declares, when the plugin comes from an official marketplace that the program vouches for. A server whose endpoint is a template still reports custom. |
Source: the program. The level in force is in chunk-r5cyd28m.js lines 135670, 136924, and 141434. The server name is in chunk-3xe0k172.js lines 44518 to 44531 and 48503 to 48514, with custom at line 42524. The safety_event gate is in chunk-r5cyd28m.js lines 186177, 186258, 186295, and 186356, and in chunk-2ht8z368.js line 184333 of 2.1.311.
Attributes on Every Event
Every event carries these base attributes: user.id, user.email, user.groups, event.name, event.timestamp, event.sequence, prompt.id, and workspace.host_paths.
When OTEL_METRICS_INCLUDE_RESOURCE_ATTRIBUTES is set, the program also copies the keys of OTEL_RESOURCE_ATTRIBUTES.
Related Pages
- Telemetry and Debug lists the variables that control telemetry.
- JSON Schemas has the exact fields in
claude-code-otel.json. - Undocumented Items indexes every undocumented item.
- Monitoring in the official docs.