[FEATURE] claude_code.tool spans don't identify which skill or agent was invoked
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
When OTEL tracing is enabled (beta), claude_code.tool spans for Skill and Agent tool invocations only include the generic tool_name (e.g., "Skill" or "Agent"). The specific skill being invoked (e.g., "compose-render", "direct-creative-brief") is not present on the span.
The corresponding claude_code.tool_result log records do include the specific name via tool_parameters and tool_input attributes, but log records do not carry traceId or spanId, so they cannot be linked back to their span.
Current span attributes:
{
"span.type": "tool",
"tool_name": "Skill",
"duration_ms": 6
}
Proposed Solution
Resolve tool_name to the actual skill/agent name instead of the generic wrapper name (e.g., "fix-docs" instead of "Skill").
Alternative Solutions
_No response_
Priority
Critical - Blocking my work
Feature Category
Developer tools/SDK
Use Case Example
When building an observability dashboard over Claude Code sessions (e.g., tracking which skills are used most, measuring per-skill latency, building operation DAGs), the span tree is the natural data source it provides timing, parent-child relationships, and trace context.
However, with tool_name: "Skill" on every skill span, it is not possible to break down metrics by actual skill without falling back to log records, which lack trace linkage.
Additional Context
_No response_
6 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
claude_code.toolspans not identifying which skill or agent was invoked is a critical observability gap for multi-skill and multi-agent deployments — without this, traces show "a tool was called" but not "which tool, by which agent, in which skill context," making them nearly useless for debugging complex agent pipelines.From an agent identity and behavioral trust perspective, the span identity gap is the same problem as the team agent tab UI gap (#48910 host identity) and the unnamed session problem (#48753 name lost after compaction) — in all cases, the agent's identity is present in the system but not surfaced where it is needed.
Minimum required span attributes for
claude_code.tool:With these attributes, a trace shows: "session
abc123, running skillcode-review, agentopus-agent-1, called toolBashwith args[...]." That is a meaningful behavioral record.The
claude_code.tool.skill_nameis particularly important for debugging: when a tool call fails inside a skill, knowing which skill was active at the time of the failure is the first step in diagnosing whether the failure is in the skill itself or in the tool implementation.This also enables skill-level cost attribution —
GROUP BY claude_code.tool.skill_nameon your traces gives you cost per skill, which is essential for optimizing complex agent deployments.The missing piece is probably span attributes, not new span types.
claude_code.toolshould carry something likeclaude.skill.name,claude.agent.name, and maybeclaude.invocation.kind=skill|agent|mcp, so downstream OTEL backends can group tool calls without parsing prompt text. If those are only known at dispatch time, attaching them where the tool/skill router resolves the target is enough; OTEL semantic conventions are fine with vendor-prefixed attrs when there isn’t a standard field yet.It’d also help to set the span name to the resolved target when possible, e.g.
claude_code.tool:search_codebaseinstead of a generic tool span, while keeping the generic operation in an attribute for stable dashboards. That gives both readable traces and low-cardinality aggregation. This would make systems like PeKG much better at linking traces back to the exact skill/agent behavior that produced a decision or memory write.Hey @mhegazy, I noticed you marked this GitHub issue as completed. Can I assume it has been implemented? If so, do you know which release it will be included in?
All good see it in the newest update thanks @mhegazy.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.