Skip to content

10. A Grafana Dashboard That Answers "What's Wrong?" in Ten Seconds

Telemetry pipelines are easy to build and hard to use well — the common failure is fifty panels pasted from default exporters, and still asking “is the site slow or broken?” in Slack during an incident. The rule this lesson works from: if a panel doesn’t change your next action during an incident, delete it. Everything gets organized around Google’s four golden signals — latency, traffic, errors, saturation — because together they narrow the guesswork; individually, each one tells a partial and sometimes misleading story.

A fictional incident, worked through all four signals

Section titled “A fictional incident, worked through all four signals”

Marketing runs a surprise 50%-off flash sale. Traffic triples in four minutes. The business symptom: “checkout spins.” Walking it through each signal shows why no single one is enough alone — p95 latency for POST /api/orders jumps from 180ms to 4 seconds while p50 barely moves (a queue behind a shared resource, not a uniformly slow system). Traffic spikes specifically on the write path (/api/cart, /api/orders), while the read-only product catalog stays mostly fine. Errors climb to 2%, with Loki logs showing Postgres refusing new connections. And CPU on the API container sits at a boring 60% — not obviously “maxed,” which is exactly why CPU-only dashboards mislead: the actual constrained resource is the database connection pool, not compute. A trace for one failed checkout makes the real story visible directly: 3.8 seconds mostly spent waiting to acquire a database connection, not executing the query itself.

Building the dashboard surfaced three real, separate bugs

Section titled “Building the dashboard surfaced three real, separate bugs”

Dashboards weren’t actually persisting. Grafana’s SQLite database lives at /var/lib/grafana — with no volume mounted there, every dashboard built through the UI, including the one just imported, vanished on the next docker compose down. A real gap the course material didn’t originally account for, since it assumes a container that stays running rather than one stopped and started across sessions. Fixed with a volume mount — which then hit a second, smaller problem: Grafana’s container runs as UID 472 internally, and the newly created host directory was owned by the regular user, so the container couldn’t write to it until ownership was explicitly corrected to match.

The dashboard’s datasource references were placeholder strings, not real IDs. The importable JSON referenced Prometheus and Loki by the literal string "prometheus"/"loki" — Grafana’s actual internal datasource UIDs are longer generated strings unique to each instance. Every panel showed a red warning triangle until the real UIDs were pulled from each datasource’s settings URL and substituted in.

Trace-to-logs linking was broken by the same class of bug, in a different file. The Tempo datasource’s tracesToLogs config pointed at the literal string loki instead of the real UID — the exact same mistake as the dashboard JSON, just living somewhere separate, so fixing one didn’t fix the other. Underneath that: the config key itself was outdated (tracesToLogs vs. current Grafana’s tracesToLogsV2), and the deeper issue was that Promtail’s config only ever attached a container label to log lines — never a service_name label — so a query trying to match traces to logs by service name had nothing to match against, for app containers specifically. An explicit relabel rule, deriving service_name=pretzel-backend from the container name pattern, closed that gap.

Two things from the lesson’s own scope explicitly didn’t make it into the finished dashboard: a saturation row (DB pool wait time, event loop lag, Redis memory — the fourth golden signal never got wired up), and a k6 load-testing row. Worth saying plainly rather than implying the dashboard covers more than it does — a dashboard that’s honest about its own gaps is more trustworthy than one that looks complete and isn’t. A separate, genuinely interesting finding surfaced along the way: the backend has no request-logging middleware at all, so the Loki errors panel and trace-to-logs linking will stay empty for real application traffic regardless of how correctly the Grafana config is wired — a limitation at the app layer, not the observability stack.

On-call runbooks typically link one primary dashboard per service, with everything else labeled “advanced” — the same golden-signal PromQL that lives in a dashboard panel today becomes an alerting rule tomorrow, once thresholds get tuned against real traffic rather than copied in on day one. The recurring shortcut that actually hurts teams: dashboards built as vanity walls on office TVs with fonts too small to read during an actual incident, optimized for a demo instead of the laptop screen of whoever’s paged at 3am.


Next: Lesson 11, Outage Simulation.