claude-code - 💡(How to fix) Fix [DOCS] Monitoring reference omits subagent `agent_id` and `parent_agent_id` on OTEL tool spans [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#60686Fetched 2026-05-20 03:52:08
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×4

Fix Action

Fix / Workaround

For the v2.1.145 tracing change, this leaves the tool-span schema incomplete: someone querying OpenTelemetry traces can see that subagent spans nest under the dispatching tool span, but the reference does not tell them that the dispatching/subagent tool spans also carry agent_id and parent_agent_id for correlation.

RAW_BUFFERClick to expand / collapse

Documentation Type

Incorrect/outdated documentation

Documentation Location

https://code.claude.com/docs/en/monitoring-usage

Section/Topic

Traces (beta)Span hierarchy and Span attributes

Current Documentation

The docs currently say:

Each user prompt starts a claude_code.interaction root span. API calls, tool calls, and hook executions are recorded as its children. Tool spans have two child spans of their own: one for the time spent waiting on a permission decision and one for the execution itself. When the Task tool spawns a subagent, the subagent's API and tool spans nest under the parent's claude_code.tool span.

claude_code.llm_request

AttributeDescription
agent_idIdentifier of the subagent or teammate that issued the request. Absent on the main session
parent_agent_idIdentifier of the agent that spawned this one. Absent for the main session and for agents spawned directly from it

claude_code.tool

AttributeDescription
tool_nameTool name
duration_msWall-clock duration including permission wait and execution
result_tokensApproximate token size of the tool result
subagent_typeSubagent type for the Task tool

What's Wrong or Missing?

The page documents the subagent trace-parenting change, and it documents agent_id / parent_agent_id for claude_code.llm_request spans, but the claude_code.tool attribute table does not document those same subagent-attribution fields.

For the v2.1.145 tracing change, this leaves the tool-span schema incomplete: someone querying OpenTelemetry traces can see that subagent spans nest under the dispatching tool span, but the reference does not tell them that the dispatching/subagent tool spans also carry agent_id and parent_agent_id for correlation.

Suggested Improvement

Add agent_id and parent_agent_id rows to the claude_code.tool span attribute table, with the same scope notes used for claude_code.llm_request:

  • agent_id: identifier of the subagent or teammate that issued the tool span; absent on the main session
  • parent_agent_id: identifier of the agent that spawned this one; absent on the main session and for agents spawned directly from it

That would make the trace-parenting explanation and the span-attribute reference consistent for subagent tracing.

Impact

Medium - Makes feature difficult to understand

Additional Context

Affected Pages:

PageLine(s)Context
https://code.claude.com/docs/en/monitoring-usage141-177, 199-209Span hierarchy documents nested subagent traces, but the claude_code.tool attribute table omits subagent-attribution fields
https://code.claude.com/docs/en/agent-sdk/observability145-149SDK observability guide repeats the nested-subagent trace model and points readers back to the monitoring reference for span details

Total scope: 2 pages affected

Relevant changelog version: v2.1.145

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [DOCS] Monitoring reference omits subagent `agent_id` and `parent_agent_id` on OTEL tool spans [1 participants]