Metrics Monitoring: Deep Dives and Curveballs
The design is drawn, and from minute thirty to minute forty-five it gets priced. Three things are still only asserted: that a point costs two bytes, that collectors with no state can count series, and that an alert can outlive what it watches. After those, the interviewer changes the question four times.
The Write Path and Its Tiers
Start with the parked two bytes. Timestamps tick evenly, so you store the change in the change, which is nearly always zero and comes to almost nothing. Values barely move, so you store how each one differs from the last, bit by bit, and that comes to very little. The room needs that much. The rest is Observability Deep Dive's lesson on TSDB Internals.
Now price the tiers, from 350 GB a day. Fourteen days of 10-second points is 4.9 TB. A 5-minute rollup, one summary for every five minutes, has 30 times fewer points and four values each. That is about 47 GB a day, so 90 days is 4.2 TB. An hourly one has 360 times fewer points, about 3.9 GB a day, so two years is 2.8 TB.
That is about 12 TB, against 255 TB for two years of raw points: a twentieth. Each step down loses the moment a spike happened, first to within five minutes and then to within an hour. With two copies, 24 TB over 16 nodes is 1.5 TB each, inside the 2 TB assumed, which leaves a quarter of each disk for the index, the append files and blocks waiting to be dropped. Dropping a whole block is what keeps retention cheap, since nothing is deleted point by point.
Use these tiers while people look at recent data closely and old data broadly. The trigger for changing them is a team that needs a month of raw points, and that team pays for its own tier. Say it with the number: "Fourteen days of raw down to two years of hourly comes to about twelve terabytes, a twentieth of keeping it all. If a team needs more raw points, that has a price I can name." Here is the price. Thirty days of raw for a team with a tenth of the series is about 1 TB a copy.
Cardinality as a Budget
The user ID label was the loud case. Cardinality, the count of distinct series, is what the index and memory pay for, and short-lived series cost most. A host name that changes on every deploy leaves a trail of dead series, each one still in the index until its block ages out, while the active count looks fine.
You have three options. A budget per metric is the one already at the door. A budget per team gives each team a number to spend. Dropping a label at the collector keeps the metric and loses the distinction. Choose per metric first, and per team once there are many metrics, because a per-metric budget does nothing about a team that mints new names. Either way, each owner sees a series counter.
The cost is in the counting. Stateless collectors need a shared count. Each collector remembers the series it has recently let through, reports new ones to a shared count that ignores a series it already holds, and learns the total a few seconds late, so the budget is a little late and a little wrong. That is acceptable here, because it protects memory in tens of gigabytes and is no bill to the cent. The trigger for tightening it is series growing faster than servers. If the counter is unreachable, collectors keep passing known series and hold back new ones, so its failure never reaches the alert path.
The Alert That Outlives What It Watches
The alert job you marked on the first board ends here. Assume a critical rule holds for 30 seconds before it pages, so a blip does not wake anyone. That leaves 30 of the agreed minute. The agent's tick can take 10 of them, which leaves 20 for the log and the notifier, and a curveball below spends most of those. The evaluators add no interval of their own, because they check each point as it arrives.
Two evaluators firing is the normal case, so the notifier deduplicates by rule and series, the duplicate you expect from Chapter 6's Delivery Semantics at Scale. Each evaluator keeps its recent points in memory, and ten minutes of them is about 1 GB, which is why it can be small.
No data is a state. "Above 90 percent" stays silent if the series vanishes, so a critical rule says what absence means, and absence can page. A rule that needs a week of history cannot run on ten minutes of memory. It stays on the store, and it is marked as not surviving the store's failure. Say which is which, because the interviewer will ask for one of each.
Pushing has each agent send on its own timer, so short jobs work, and so do hosts behind a NAT, the address translator that lets a private host call out and lets nobody call in. A silent host looks like nothing at all. Use it where the system cannot reach the host, or the host may be gone by the next pull.
Pulling has the system ask each target, so a miss is a signal and the system sets the pace, and it needs a target list and a route in. Use it inside a network you run.
Curveballs
"Some jobs run for five seconds, and some hosts sit behind a NAT." A five-second job can finish between two 10-second pulls, and a host behind a NAT cannot be reached at all. This design pushes, so both already work, and the curveball only bites where a long-lived fleet is on pull. Then push for those and leave that fleet as it is. The store does not care how a point arrived.
"One rack switch dies, and ten thousand pages go out for one outage." This is the alert storm you parked. Group by what failed: one page with a count, per service and failure domain, after about 15 seconds of gathering. That happens in the notifier and in the alert job's own call to the pager, and on the critical path it is nearly all the agreed minute has left. Let an upstream alert, one on the switch itself, suppress what sits below it. A second incident can hide inside a group, so the count goes on the page. Paging policy itself is Observability Deep Dive's.
"Finance wants long-term storage at a tenth of the cost." Ask a tenth of what. Against keeping every raw point, the tiers already win, at a twentieth. Against today's 24 TB on nodes, blocks are immutable, so everything past 14 days can move to an object store, where 5,500 reads a second per key prefix is plenty for blocks few charts open. That leaves about 11 TB on nodes, the raw points and the newest rollups. Reaching a tenth on nodes alone means cutting raw to about three days. A cold range answers slowly, so say which: any chart reaching past 14 days, the thirty-day chart included. This answer needs no price.
"A whole region goes dark. What does your monitoring say?" Nothing, if it lives there. Each region runs its own stack, and a small watcher in another region checks each one's heartbeat, so the silence becomes the page. Writes never cross regions, which keeps the round trips of 70 to 85 milliseconds off the write path.
How Each Level Answers
Mid-level candidates reach a time-series store once the arithmetic is out, and add rollups when the long chart is raised. They explain that a label multiplies series, after a hint. They keep alerts on the same store until asked what happens when it goes down.
Senior candidates say why the key is series inside time, price the tiers in terabytes, and refuse the label at the door. They raise the alert path before the interviewer does, say what it still shares, and make silence a signal.
Staff candidates ask who pays for a label, and bring budgets in without breaking a team mid-incident. They plan for monitoring and production sharing a region, a deploy tool or a network, and they ask which one it is here.
- Spending the deep dive on bit-level encoding, and running out of time for cardinality. The interviewer wanted to hear about the label.
- Answering the storm with fewer alerts. The interviewer asked about one outage, not your rules, and the next outage needs those rules.
- Keeping the watcher of a region inside that region. It goes dark with what it watches, and the silence reaches nobody.
- Describing how to use a monitoring stack rather than how to build one. The answer sounds like an operator's, and the design is left undrawn.
- The tiers priced aloud, with what each one loses.
- Absence of data treated as an event with a rule of its own.
- What is deliberately left weak, such as a rule that cannot survive the store, stated without being asked.
Knowledge Check
"One rack switch dies, and ten thousand pages go out for one outage." What is your best move?
- Raise the thresholds, so that far fewer rules fire when a rack goes
- Cap the pager at ten pages a minute for each engineer on call
- Group by what failed, and send one page with the count written on it
- Delete the rules for each host, and keep only the ones for each rack
"Some jobs run for five seconds." Suppose the long-lived fleet is on pull. What is your move?
- Pull everything every second, so that no job can slip through a gap
- Let those jobs push, and leave the long-lived fleet on what it has
- Keep the job running until the next pull has had time to collect it
- Move the whole fleet over to push, so that one mechanism covers it
"Finance wants long-term storage at a tenth of the cost." What does that take?
- Cutting every agent to one reading a minute across the whole fleet
- Asking a tenth of what, then moving what is past 14 days off the nodes
- Compressing the raw blocks harder, to a fraction of their 2 bytes
- Dropping the two-year hourly tier, since it is most of what is stored
"A whole region goes dark." Where does the watcher of that region live?
- In a second zone of that region, beside the pair of evaluators
- Inside each region's own stack, which then reports on its own health
- In one central region that also takes the writes of all the others
- In another region, listening to that region's heartbeat for a silence
You got correct