Grafana: The ShopSentry Dashboard
A dashboard is one screen that answers how a service is doing right now. The ShopSentry dashboard answers it with five panels: one for each golden signal, plus a table of traffic by route.
Latency panel: p95 request time
This query gives the 95th percentile of ShopSentry request time.
histogram_quantile(0.95, sum by (le) (
rate(http_request_duration_seconds_bucket[5m])
))Traffic panel: requests per second
This query counts requests per second across all routes.
sum(rate(http_requests_total[5m]))Error rate panel: failed share
This query divides failed requests by all requests.
sum(rate(http_requests_total{status=~"5.."}[5m]))
/ sum(rate(http_requests_total[5m]))Saturation panel: requests in flight
This gauge reads the number of requests being handled right now.
shopsentry_in_flightExample
histogram_quantile(0.95, sum by (le) (rate(http_request_duration_seconds_bucket[5m])))Key points
- Golden signals are the four things that show a service is healthy: latency, traffic, errors, and saturation.
- Latency is how long requests take, shown here as the p95 from the latency histogram.
- Traffic is how many requests arrive, shown as requests per second.
- Errors are the share of requests that fail, shown as a percentage.
- Saturation is how full the service is, shown here as requests in flight.
- One panel answers one question, so a reader can trust each number at a glance.
In this example, the latency panel query runs against the live ShopSentry stack and returns the p95 request time in seconds. The value is small because the demo shop answers in about a millisecond when it is healthy. The same query feeds the latency panel of the dashboard built in this lesson.
Note
A flat line can mean no traffic, not a healthy shop.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
Which four signals does the ShopSentry dashboard show?