
Wire Claude Code Into Your Observability Stack: Metrics, Cost Dashboards, and Spike Alerts With Grafana Cloud
Chris Harper
2 min read
Jul 6, 2026 · 04:08 UTC
TL;DR: Two Grafana Cloud integrations surface Claude spend before the invoice — paste an Admin API key and get a pre-built dashboard with three ready-to-use alerts, or configure Claude Code's OTLP exporter for per-session granularity.
Agentic pipelines burn tokens fast and silently. By the time you see the Anthropic invoice, you've already lost context on which session caused the spike. Grafana Cloud has two official integrations that fix this.
Path 1 — Anthropic API integration (5 minutes, no code)
This is the easiest path. It scrapes the Anthropic Usage and Cost API periodically and builds a dashboard showing token spend, model breakdown, and cost trends.
Setup:
- In Grafana Cloud, open Integrations → search "Anthropic"
- Click Add integration → paste your Anthropic Admin API key
- Grafana installs the pre-built dashboard and three alert rules
Three ready-to-use alerts:
AnthropicDailyCostSpike— fires when daily cost jumps 50%+ day-over-dayAnthropicTokenQuotaApproaching— fires when usage approaches your API tier limitAnthropicHighOutputTokenRatio— detects runaway generation (output tokens dominating)
You can run multiple scrape jobs on one Grafana Cloud instance to track separate API keys or projects independently.
Path 2 — Claude Code OTLP integration (session-level)
Claude Code emits OpenTelemetry metrics and structured logs for individual sessions — tool calls, token counts per turn, latency, error events. Route them to Grafana with environment variables in your Claude Code settings:
# Set in shell profile or .claude/settings.json env block
export OTEL_EXPORTER_OTLP_ENDPOINT="https://<your-stack>.grafana.net/otlp"
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic <base64-encoded-key>"
Grafana's Claude Code integration installs a companion dashboard that shows sessions over time, tool-call frequency, and per-session cost breakdown.
Who needs this most
Teams running Claude Code in CI, agent loops, or multi-developer workflows where one runaway session can spike costs by an order of magnitude. Start with Path 1 for org-level visibility, add Path 2 when you need session-level debug granularity.
Sources: Anthropic integration for Grafana Cloud — Grafana Labs blog · Claude Code integration — Grafana Cloud docs · Anthropic integration — Grafana Cloud docs · Usage and Cost API — Claude Platform Docs