Prometheus
medium 28 minPrometheus 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 hear | Say | Because |
|---|---|---|
| How do you know it works? | Request rate, errors and duration per service, scraped every 15 s | Three numbers show what users feel |
| p99 over many servers | Histograms, added before the quantile | Percentiles cannot be averaged |
| Containers come and go | Service discovery and labels | No list to maintain |
| Metrics per user | No: logs, traces or an analytics store | Cardinality |
| Keep for years | Remote write to a long-term store | Local data is one node and 15 days |
| Invoices | Not from metrics | Sampled 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.