HOMELAB-1135: feat(pi-otel-telemetry): span-per-subagent telemetry to Tempo #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/pi-subagent-telemetry"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
HOMELAB-1135 — Pi subagent telemetry (extension)
Makes every Pi subagent (including
isolated:trueones) a first-class, self-identifying span in Tempo, parented under the session's rootpi-agentspan.What's in here
subagents.ts—SubagentSpanTracker: opens asubagent:<type>span onsubagents:started, closes it on terminal, idempotent open-spans map, shutdown sweep for abandoned spans.index.ts— subscribes tosubagents:started/completed/failed/compactedon thepi.eventsbus; carries downsession.id+plane.ticket_id; enrichesllm.modelfrom the parent model. Closes foreground (awaited) subagents from the parentAgenttool_result, since@tintinweb/pi-subagentsonly emits terminal bus events for background agents.query_telemetry— prompt guidelines so agents can self-serve subagent analysis via TraceQL/PromQL.Schema (Tempo spans)
subagent:<type>·agent.role=subagent·subagent.id|type|outcome|tool_uses|compaction_count·llm.model·gen_ai.usage.{input,output,total}_tokens·session.id·plane.ticket_id· resourcehost.name.subagent.outcome ∈ {completed, failed, aborted, stopped, steered, abandoned, unknown}.Verification
Live-verified in Tempo: both a foreground and an isolated subagent export with correct
outcome,tool_uses,total_tokens,session.id, and parent nesting (isolated-coverage proven — the events fire in the parent process).Final review fixes (this branch)
subagent.outcomefallback tounknown(no raw internal-status leak).Spec:
internal-docs/plans/2026-06-17-pi-subagent-telemetry.md· paired infra-core PR adds Tempo span-metrics dimensions + the "AI Agents" Grafana folder.🤖 Generated with Claude Code
4ee1d60d3ato46908fc34a