AlgoViz

Prometheus

medium 28 min

Prometheus is an open source monitoring server.

When it comes up

The moments this idea belongs in a design interview, and the moments it does not.

Signals

When to bring it up

You hearSayBecause
How do you know it works?Request rate, errors and duration per service, scraped every 15 sThree numbers show what users feel
p99 over many serversHistograms, added before the quantilePercentiles cannot be averaged
Containers come and goService discovery and labelsNo list to maintain
Metrics per userNo: logs, traces or an analytics storeCardinality
Keep for yearsRemote write to a long-term storeLocal data is one node and 15 days
InvoicesNot from metricsSampled and extrapolated

Options

Compare your moves

Product wants error counts for each of 200,000 customers. What do you do?

BreaksA customer label
How
Add the customer id to every request metric.
Limit
200,000 times every other label; the server runs out of memory.
Choose when
Never with unbounded values.
WorksA tier label
How
Three values: free, paid, enterprise.
Limit
You see that paid customers suffer, not which ones.
Choose when
Alerts and service goals per tier.
StrongMetrics for health, events for detail
How
Few labels in Prometheus; the customer id goes into structured logs or an analytics table.
Limit
Two systems and one jump between them.
Choose when
You need both fast alerts and answers about one customer.

Two teams, 3 million series, and the chief engineer wants a year of history. What do you run?

BreaksOne server, one year
How
Set retention to 365 days.
Limit
One disk of several terabytes, no copy, slow long queries.
Choose when
A hobby project.
WorksFederate sums
How
A second server copies recorded sums and keeps them for a year.
Limit
Only the sums you planned for.
Choose when
The year is for trends only.
StrongPairs plus a long-term store
How
Two servers per team with 15 days; Thanos, Mimir or a managed service behind.
Limit
More parts, or a bill.
Choose when
History matters and alerts must survive the store.