Metrics Monitoring: Scope
The question hands you a hundred thousand servers, and that is the one number in it you cannot design from. The real load comes from what each server sends, how long it is kept, and who gets to add to it. Minutes zero to ten go on those answers, on one sum that settles the write path, and on a requirement most candidates raise too late: what still works when the monitoring itself is down.
Four words carry this whole problem. A metric is a named measurement, such as requests served. A label is a key and value attached to it, such as a status of 500. A series is one metric with one exact set of labels. A point is one reading of one series: a time and a value.
Readings, Retention and Who Chooses the Labels
Six answers come before any drawing, each with something it changes.
- How many metrics per server, and how often? This sets the write rate the design is built around. Agreed: about 200 metrics, a reading every 10 seconds.
- How long is it kept, and at what resolution? This sets the storage, and it creates tiers. Agreed: 10-second points for 14 days, 5-minute rollups for 90 days, and hourly rollups for two years. A rollup is a summary of many points as one.
- How fast must a page go out? This sets how fresh the alert path has to be. Agreed: within a minute of the condition being true.
- Who chooses the labels? If anyone can, the series count is not yours to predict. Agreed: thousands of engineers, free-form. It returns as a probe.
- Do agents send, or does the system ask? An agent is the small program on each server that takes the readings, and this answer sets who holds the list of targets. Agreed: agents push for now, and pull comes back as a curveball.
- When the monitoring is down, who finds out? This splits the alert path from everything else. Agreed: critical pages must survive the system's own failure.
The fourth question sounds like an aside, so flag why you are asking: "Labels are the thing I can't predict, so before sizing I want to know who chooses them."
Requirements, Including the Awkward One
The functional list follows the question, with one step spelled out. Take readings. Store them as series named by metric and labels. Answer range queries, meaning a series or many of them over a stretch of time. Evaluate rules. Page a person.
The non-functional list is where the design comes from. Writes never wait on queries. A point survives losing any one store node. A dashboard may be seconds stale. And a critical page goes out within a minute with the store down. Put that last one on the board yourself, as a requirement. The interviewer should not have to drag it out of you at minute twenty-eight.
Three things go off the board out loud: logs and traces; what to alert on and how to set objectives, which is Observability Deep Dive's ground; and drawing the charts. Something renders whatever a query returns, and that is all this design needs to know about it.
Two Million Points a Second
Series first. A hundred thousand servers at 200 metrics is 20 million. That counts one series for each metric on each server, so it is where labels start from, not where they stop.
Now points. One reading every 10 seconds is 2 million points a second. Leave the peak factor off. Agents tick on a timer whatever users are doing, and an incident brings more readers to the dashboards, not more points. This number decides the write path.
Next, the bytes as table rows. Assume 100 bytes a row and a 2 TB node. The rows come to 200 MB a second, about 500 TB a month, and about 6 PB a year. One node fills in 10,000 seconds, which is under three hours.
Then the same data compressed. A series ticks evenly and its value barely moves, so assume 2 bytes a point. That is 4 MB a second and about 350 GB a day, fifty times less. How a point gets that small waits for the deep dive. The fifty is what makes a specialised store worth building.
The estimator below starts from the series count, with 8,640 points a day for each series, which is one every 10 seconds. It starts on the table's 100 bytes. Its first decision line says a year of rows would take over 3,000 nodes. Its second prices a point as one write to a key-value partition: at 500 writes a second each, half a partition's limit, that is 4,000 partitions, and it shows a point per write is the wrong shape. Drag the bytes down to 2. Storage falls by fifty, and the 4,000 does not move at all, because compression shrinks bytes and leaves the rate where it was.
Last, the rules. Assume 10,000 of them, each checked once a minute, which is about 170 a second. That decides nothing about size, and you say so, because what matters about a rule is not its rate. Keep the two numbers apart as you say them: "Two million points a second is the design. A hundred and seventy rule checks a second is small, and I'll come back to them because of what they depend on."
Three Calls and Four Entities
Agents post batches: a host, a time, and a list of readings, each with a metric, its labels and a value. A query names an expression, a range and a step, the step being how far apart the answer's points sit. A rule names an expression, a threshold, how long the condition must hold, who to page, whether it is critical, and what a missing series means.
POST /points host, time, readings: [metric, labels, value] GET /query expression, start, end, step POST /rules expression, threshold, hold_for, page_to, critical, on_absence
Four entities sit behind those calls. A series is a metric name plus its labels, and together they are its identity, so changing one label makes a new series. A point is a time and a value inside a series. A rule is what the third call stored. And an alert's state records whether a rule is quiet, waiting out its hold, or firing, so that one condition does not page twice.
- A factor of two for peak on a flow a timer sets. The arithmetic looks borrowed, and the interviewer asks what an incident does to a timer.
- Counting servers and metrics but not labels, as if the series count were known. It comes back as the probe you had no number for.
- One retention number, when tiers turn out to be the whole answer on long ranges. The storage sum you just gave has to be redone.
- Leaving who watches the watcher unasked until minute twenty-eight. By then the alert job is drawn as one more reader, and it has to be redrawn.
- 2 million points a second reached in two sentences, aloud.
- A reason why no peak factor applies here, not just its absence.
- The alert path's independence raised as a requirement, not offered later as a feature.
Knowledge Check
You have time for one more question before you draw. Which answer changes the shape of this design most?
- How often each agent sends, every 10 seconds or every 60 seconds
- How many people have dashboards open during a typical incident
- Which of the teams will pay for the dashboards that they build
- When the monitoring itself is down, who finds out that it is
A hundred thousand servers, 200 metrics each, a reading every 10 seconds. What do you say out loud?
- 200 million series, and 20 million points arriving every second
- 20 million series, and 2 million points arriving every second
- 20 million series, and 20 million points arriving every second
- 2 million series, and 200,000 points arriving every second
Why does the 2 million a second carry no factor for peak?
- Agents tick on a timer, so an incident adds readers and no points
- Compression flattens any burst of points before it reaches disk
- The collector smooths the peak by holding points for a short while
- Monitoring traffic stays small beside the traffic that it measures
Which of these can you safely rule out, out loud, in the first ten minutes?
- A critical page with the store down, since that is a later feature
- Free-form labels, because teams can be asked to keep to a fixed list
- Drawing the charts, since something else can render a query's answer
- Retention past 14 days, because nobody opens a chart that far back
You got correct