Our old service dashboard had twenty-six panels. During an outage the on-call engineer scrolled through all of them, found that "CPU looks fine", and spent fifteen minutes before noticing the error rate had started climbing exactly when a deploy went out. The dashboard had the data. It was laid out to show that things were healthy, not to find out why they were not.
This post is the layout we now use for every service, built in Grafana with Prometheus metrics and Loki logs, though the ideas carry over to any stack. The goal is that someone who has never seen the service can answer three questions in under two minutes: is it broken for users, what changed, and where to look next.
Start from the questions, not the metrics
We list the questions an on-call engineer asks, in order, and give each one a row:
Are users affected? Request rate, error ratio, latency against the SLO.
What changed? Deploys, config changes, feature flag flips, traffic shifts.
Is it us or a dependency? Saturation of our resources and of the things we call.
Which error is it? The most frequent error types right now, compared with an hour ago.
Every panel that does not help answer one of these moves to a second "deep dive" dashboard. Fewer panels load faster and are read more carefully.
Row 1: RED for the service
The RED method, popularised by Tom Wilkie, covers request-driven services with three signals: Rate, Errors and Duration. With OpenTelemetry HTTP metrics exported to Prometheus, the server histogram is http_server_request_duration_seconds:
# Rate, requests per second by route
sum by (http_route) (rate(http_server_request_duration_seconds_count{service_name="orders-api"}[5m]))
# Error ratio, 5xx over all
sum(rate(http_server_request_duration_seconds_count{service_name="orders-api", http_response_status_code=~"5.."}[5m]))
/
sum(rate(http_server_request_duration_seconds_count{service_name="orders-api"}[5m]))
# p99 latency
histogram_quantile(0.99,
sum by (le) (rate(http_server_request_duration_seconds_bucket{service_name="orders-api"}[5m])))
Three rules make this row useful during an incident:
Show the SLO threshold as a line on the latency and error panels. "p99 is 800 ms" means nothing without "and our target is 500 ms".
Split rate by route, but not errors and latency by default. Twenty overlapping lines hide the one that matters; use a variable to filter by route when needed.
Use the same time range everywhere and do not set per-panel overrides. Mismatched ranges have misled us more than once.
Row 2: what changed
This row is the one most dashboards lack and the one that shortens incidents the most.
Deploy markers
Grafana annotations draw a vertical line across every time-series panel. We post one from the deploy job:
curl -sS -X POST "https://grafana.example.com/api/annotations" \
-H "Authorization: Bearer ${GRAFANA_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"tags\":[\"deploy\",\"orders-api\"],\"text\":\"orders-api ${VERSION} (${GIT_SHA:0:8})\"}"
The dashboard has an annotation query filtered on the deploy and service tags, so every panel shows when each version went out. An error ratio that starts rising two minutes after a deploy line is the fastest root cause signal we know.
We post annotations for config changes and feature flag flips in the same way, with different tags and colours. If your flag service has webhooks, send them straight to the annotations API.
Version breakdown
A small panel showing request rate by service_version label answers "is the new version taking traffic?" and makes canary problems obvious, because the error ratio can be split by version too.
Row 3: USE for resources and dependencies
Brendan Gregg's USE method checks every resource for Utilisation, Saturation and Errors. For a typical service the resources are not only CPU and memory:
Resource | Utilisation | Saturation | Errors |
|---|---|---|---|
CPU | usage vs limit | throttled periods | - |
Memory | working set vs limit | - | OOM kills |
DB connection pool | in-use / max | waiters, wait time | acquire timeouts |
Worker queue | busy workers | queue depth, age of oldest job | failed jobs |
Downstream HTTP | calls in flight | client-side queueing | timeouts, 5xx by host |
Saturation is the column people skip and the one that explains most "everything looks fine but it is slow" incidents. A connection pool at 100% with forty waiters will not show up in CPU graphs at all. For Kubernetes CPU, throttling is the saturation signal:
sum(rate(container_cpu_cfs_throttled_periods_total{namespace="orders", container="orders-api"}[5m]))
/
sum(rate(container_cpu_cfs_periods_total{namespace="orders", container="orders-api"}[5m]))
For dependencies, we show the client-side view (our calls to the payment provider, by status and latency) rather than relying on the provider's status page. It updates in seconds and reflects what our users see.
Row 4: top errors
A table of the most frequent error types in the last fifteen minutes, next to the same count an hour earlier, tells you whether an error is new or background noise. With structured logs in Loki:
topk(10,
sum by (event, error_type) (
count_over_time({service="orders-api", env="prod"} | json | level="error" [15m])
)
)
The second column is the same query with offset 1h. We add a third panel listing the five most recent error lines with their trace_id. This only works if logs are structured with stable event names; free-text logs make this panel useless.
One click from panel to evidence
A dashboard that shows the problem but requires copying label values into another tool slows everything down. Grafana data links fix this. On the error ratio panel we add a link to Explore with the logs query pre-filled and the time range carried over:
/explore?left={"datasource":"loki","queries":[{"expr":"{service=\"orders-api\"} | json | level=\"error\""}],"range":{"from":"${__from}","to":"${__to}"}}
The ${__from} and ${__to} variables pass the current dashboard range. On latency panels we enable exemplars, which attach trace IDs to histogram samples so clicking a spike opens a real slow trace in Tempo or Jaeger. In the logs data source, a derived field that matches trace_id turns every log line into a link to its trace.
The result is a path that never needs copy and paste: dashboard spike, then error logs for that window, then the trace of one failing request, then the span that failed.
Variables and consistency
Every service dashboard is generated from the same template with service and env variables. We keep it as code (JSON in the repository, provisioned by Grafana's file provisioning or managed through its API) so changes are reviewed and every service gets improvements at once. Consistency is the feature: the error panel is always top-middle, the deploy markers always blue.
Common mistakes
Mistake | Why it hurts | Do this instead |
|---|---|---|
Averages for latency | Hide the slow tail users feel | p95/p99 from histograms |
No deploy markers | "What changed" takes minutes to answer | Annotations from the deploy job |
Only our own CPU and memory | Saturated pools and queues stay invisible | USE across pools, queues, dependencies |
Dozens of panels | Slow to load, skimmed not read | Four rows, deep dive elsewhere |
Dashboards edited by hand | Each service drifts | Template as code with variables |
Key takeaways
Lay the dashboard out in the order of on-call questions: user impact, change, saturation, errors.
RED for the service, USE for every resource it depends on, including pools and queues.
Deploy, config and flag annotations turn "what changed" into a glance.
A top-errors table with an hour-ago comparison separates new errors from noise.
Data links, exemplars and derived fields give one-click paths from panel to logs to traces.
References
Grafana annotations: https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/annotate-visualizations/
Grafana data links: https://grafana.com/docs/grafana/latest/panels-visualizations/configure-data-links/
The RED method, Grafana Labs: https://grafana.com/blog/2018/08/02/the-red-method-how-to-instrument-your-services/
The USE method: https://www.brendangregg.com/usemethod.html
OpenTelemetry HTTP metrics semantic conventions: https://opentelemetry.io/docs/specs/semconv/http/http-metrics/
Prometheus histograms and quantiles: https://prometheus.io/docs/practices/histograms/
Comments
0No comments yet. Be the first to comment!
Sign In to post a comment.