
Fleet observability for parallel Claude Code: built-in OpenTelemetry, Grafana cost dashboards, and per-agent spend attribution
Wire every parallel Claude Code session, subagent, and headless run into one OpenTelemetry feed and watch per-agent token burn and dollar cost on a Grafana dashboard, with stall detection that catches a looping agent before it drains the budget. The one trap: the same opt-in log flags that give you attribution can ship raw prompts and pasted credentials to your observability backend, and one shared API key collapses every worktree's cost into a single lying bucket.
Episode page & show notes
Try a walking desk - stay healthy & sharp while you learn & code
This week's Claude Code releases, then a full tutorial on fleet observability and cost dashboards for parallel runs.
News (2026-06-26 to 2026-07-03, from the Claude Code changelog):
- Claude Sonnet 5 is now the default (v2.1.197, Jun 30): native 1M-token context, promo pricing $2/$10 per Mtok through Aug 31. Shows in /model. (Some trackers misdate it to Jul 1 - the docs changelog is authoritative.)
- Background subagents by default (v2.1.198, Jul 1): agents keep running and notify on finish; claude agents runs now commit, push, and open a draft PR from a worktree; Notification hook fires agent_needs_input/agent_completed; Explore agent inherits the session model (capped at opus); new /dataviz skill; the /agents wizard was removed.
- Stacked skills + retry controls (v2.1.199, Jul 2): /skill-a /skill-b loads up to 5; CLAUDE_CODE_RETRY_WATCHDOG raises retries to 300; fixed subagents reporting usage-limit errors as success, plus a Linux daemon that killed all agents every ~50s.
- Org defaults + durability (v2.1.196, Jun 29): admin org default model, stream idle watchdog on by default, background sessions survive restarts.
Tutorial - Fleet observability and cost dashboards:
- Native OpenTelemetry, opt-in via CLAUDE_CODE_ENABLE_TELEMETRY=1 - Monitoring docs. Metrics like claude_code.cost.usage, claude_code.token.usage, claude_code.active_time.total; log events; beta trace spans (claude_code.interaction root).
- Reference stack: ColeMurray/claude-code-otel (Collector to Prometheus + Loki to Grafana, six-section dashboard).
- Cost tools: /cost slash command (Manage costs); ccusage (npx ccusage@latest, ccusage blocks --live); org-level Usage and Cost API and the per-user Claude Code Analytics API.
- Headless mode: claude -p --output-format json returns total_cost_usd, num_turns, session_id; guard with --max-turns and --max-budget-usd.
- AWS worked example: Analyzing Claude Code usage with CloudWatch and OpenTelemetry.
- Pitfall: OTEL_LOG_USER_PROMPTS=1 / OTEL_LOG_TOOL_DETAILS=1 leak prompt text and credentials (Elastic Security Labs); one shared API key breaks per-worktree attribution.
المعلومات
- البرنامج
- معدل البثيتم التحديث أسبوعيًا
- تاريخ النشر٣ يوليو ٢٠٢٦ في ٨:٢٣ ص UTC
- التقييمملائم