AlgoViz

Visualizing monitoring data

easy 28 min

A dashboard answers questions at a glance: is it fine, since when, and where is the problem?

Video lesson · Chapter 1 of 6

Start from a service question

0:00 / 3:30

Theory

Read or listen first. About 1 min.

What it is

Visualizing monitoring data means turning numbers over time into pictures that a person can read in seconds. A panel is one picture. A dashboard is a page of panels that together answer one kind of question.

A good dashboard is made for a reader with a question: somebody who was just called, a team that looks at its week, or a manager who wants to know whether the promise is kept.

Why it exists

People see a bend in a line long before they find it in a list of numbers. A picture shows patterns, such as the same spike at every full hour.

It gives a team one common view. Discussions begin with what happened and not with whose numbers are right.

It shortens repairs. But only if it is clear: a wall of forty equal charts makes people slower.

A short history

  1. 1786

    William Playfair publishes the Commercial and Political Atlas with 43 charts of values over time.

  2. July 1999

    Tobias Oetiker releases RRDtool, which stores measurements and draws them.

  3. 2014

    Grafana version 1 appears. Its author began with Kibana 3 and wanted editing to be easier.

Words to know

Panel
One picture with its query.
Time series chart
Values over time, usually as lines.
Stat
One large number, often coloured by a limit.
Gauge
One value on a scale with limits. Not the metric kind of the same name.
Heatmap
How values are spread, over time. Darker means more.
Variable
A choice at the top, such as service or region, used by all panels.
Threshold
A value at which the colour changes.
Annotation
A mark in time, such as a release.
Recording rule
A query calculated in advance and stored as a new series.

Understand it

Start here

The weather wall of a sailing club

One wall for everybody
OKwindwavestide

The wall is for the person who must decide now.

At the clubIn the system
Green lightStat panel for health
DialGauge
Line of the windTime series
Red lineThreshold
SwitchVariable
NoteRunbook link

The idea

Four reasons and three principles

Why a picture

  • Quick

    One look instead of a list of numbers.

  • Patterns

    Steps, spikes, daily waves.

  • Together

    The same picture for all teams.

  • Faster repair

    Where to look next is visible.

PrincipleMeaning
OrderThe most important at the top left
ContextLimits, history, comparison with last week
ActionEvery panel answers a question somebody asks

Which numbers belong on it is decided before: rate, errors and duration for services, utilization, saturation and errors for resources. See monitoring basics.

Charts

Which chart for which question?

ChartQuestionExamples
Time seriesHow does it change?Request rate, error share, P99
StatHow is it now?Availability 99.97%, active users
GaugeHow close to the limit?Disk used, CPU, queue length
HeatmapHow is it spread over time?Duration buckets, errors by hour
TableWhich one exactly?Slowest routes, services compared
Bar chartWhich is larger?Requests by region, errors by type

Choose the chart

A table panel

ServiceRequests a secondErrors
api1,2000.1%
web8001.2%
db2,4005.0%
Sorted by errors, the db row would be first. Sort by what matters.

Pie charts make it hard to compare slices. With more than five parts use bars. Time never belongs in a pie.

A heatmap shows what a P99 line hides: two groups of users, one fast and one slow, or a thin layer of very slow requests above a fast mass.

Page

A layout that works

Where a picture comes from

Services are read by a metrics store. Recording rules calculate in advance. Grafana reads the results and a log store, and a person opens the dashboard. Dashboard files come from a code repository.
Blue: reading. Orange dashed: dashboards as code.
RowShowsChart
1Availability, requests a second, error share, P99Four stats
2Rate, errors, duration over timeThree time series
3By route, by status codeTables or bars

Four levels of detail

LevelQuestionWhere
1Is it fine?Stats, seen first
2How does it change?Time series
3Which route is slow?Tables
4What happened at 14:34?Logs and traces, one click away

From the call to the cause

Each click keeps the time range and the service.

Three kinds of dashboard

KindContentFor
ServiceRED of one serviceDevelopers
SLOBudgets, availabilityOperations and managers
InfrastructureUSE of machinesPlatform team

The last level is explained in inside a logging service. Grafana's own advice says the same: USE tells how happy your machines are, RED how happy your users are, and alerts should be on symptoms.

Reuse

Variables

VariableValues
$serviceapi-gateway, user-service, payment
$environmentprod, staging, dev
$regionus-east, eu-west, ap-south
One dashboard instead of 3 x 3 x 3 = 27 copies.
promql
sum by (service) (  rate(http_requests_total{service=~"$service",                           region=~"$region"}[$__rate_interval]))
The variable is a filter in every query. $__rate_interval chooses a window that fits zoom and scrape interval.

Design

Make it readable

Do

  • Important things at the top left.
  • The same colours everywhere.
  • Limits that show what is normal.
  • Links to runbooks and details.
  • Units on every axis: req/s, %, ms.

Do not

  • More than about 15 panels.
  • Pies with more than five parts.
  • Numbers that do not belong together in one chart.
  • All colours of the rainbow.
  • A default range that fits nobody.
ColourMeaningAlso say it with
GreenFineThe word OK
YellowLook at itThe word warning
RedActThe word critical, a thicker line
BlueNeutralNothing
WCAG: colour must not be the only visual means of conveying information. Many people cannot tell red from green.

How a chart can lie

Trick, often by accidentBetter
Axis from 99.0 to 100 without saying soShow the range in the title
Two axes with two unitsTwo charts, one above the other
Stacked areas of sharesLines
Average over long blocksMaximum beside the average
Gaps drawn as a line or as zeroShow the gap

Detail

The spike that disappeared

A chart has about a thousand points. A day with a sample every 15 seconds has 5,760. So several samples become one point. With the average, a short spike shrinks.

Samples per point

24×360015=5760,57601000≈6\frac{24 \times 3600}{15} = 5760,\qquad \frac{5760}{1000} \approx 6
Five values of 100 and one of 700 give an average of 200. The maximum is still 700.

Show maximum and average, or a percentile that is calculated over the whole window. Zoom in before you say that nothing happened.

The window of a rate matters too. With a window of 5 minutes a spike of 10 seconds is spread over 5 minutes. A window shorter than two scrape intervals shows nothing at all, because a rate needs two samples.

Cost

Dashboards are load

Queries a second

100 viewers×15 panels30 s=50 queries per second\frac{100\ \text{viewers} \times 15\ \text{panels}}{30\,\text{s}} = 50\ \text{queries per second}
And during an incident everybody opens it and chooses 7 days.
ExpensiveCheaper
Refresh every 5 s30 s to 5 min
Range 30 days by defaultLast hour
P99 over all series at each viewA recording rule
40 panels on one pageRows that load when opened
A table of all routesThe ten largest
YAML
groups:  - name: payment    rules:      - record: service:http_errors:share5m        expr: |          sum by (service) (rate(http_requests_total{status=~"5.."}[5m]))            / sum by (service) (rate(http_requests_total[5m]))
Recording rules: Prometheus calculates once per interval, all viewers read the result.

Care

Dashboards as code

  1. 1

    Choose the question

    Who reads this, in which situation?

  2. 2

    Build

    Metrics, charts, layout, ranges, variables.

  3. 3

    Limits and links

    Thresholds, alert rules, runbook.

  4. 4

    Review

    JSON in version control, like any code.

  5. 5

    Share

    Rights by team, links in runbooks, the owner's name on the page.

  6. 6

    Delete

    Nobody opened it for three months? Ask, then remove.

Life of a dashboard

Does this panel stay?

Tools

Programs and their languages

ToolKnown forMind
GrafanaMany sources, alerting, dashboards as JSONTakes time to learn
KibanaExploring logs (Discover), quick charts (Lens)Tied to Elasticsearch. Canvas only for upgraded installations that already use it
DatadogMetrics, logs and traces as a serviceCost grows with volume
New Relic, SplunkApplication monitoring; search over machine dataCompare prices for your volume
LanguageUsed inExample
PromQLPrometheus, Grafanarate(http_total[5m])
KQLKibanastatus:500 and service:api
LogQLLoki{job="api"} |= "error"

Summary

The whole topic in one minute.

Choose the question, then the chart. Health at the top left, trends below, tables at the bottom, logs one click away. Show limits, units and releases, and never colour alone.

Dashboards are code: reviewed, owned, few. They explain alerts and do not replace them. Keep queries cheap, because many people open them at the worst moment.

  • Question first, chart second.
  • Health, trends, details, logs.
  • Units, limits, releases on every chart.
  • Never colour alone, never the average alone.
  • Variables instead of copies, recording rules instead of heavy queries.
  • Owner, review, deletion.

Sources