KatInterview

Build a Time-Series Observability Pipeline for a Large Fleet

System DesignModel answer
HardModel answerSystem Designmonitoringtime-seriescardinality

Last updated

Design an end-to-end metrics collection and alerting system for tens of thousands of hosts, then go deep on cardinality control, storage layout, or alert evaluation.

The Problem

Your team is responsible for building an internal observability platform. Thousands of hosts, each running one or more services, continuously produce numeric measurements: request throughput, error counts, latency percentiles, CPU usage, memory consumption, and more. Engineers need to visualize trends on dashboards and get paged when something goes wrong.

Your job is to design this system.

You don't need to design every layer in equal detail. Start with a concise end-to-end walkthrough of the whole pipeline, then commit to one or two components and design them with real depth — justify your choices, get concrete on data structures, and name the trade-offs.


Before you start: clarifying questions worth asking

A good design begins by nailing down scale and requirements. Consider questions like:

  • How many hosts and services are we talking about? How many distinct metric names does each service emit, and how often?
  • Do hosts push their measurements out, or does a central scraper pull from each one on a schedule?
  • How long must raw history be retained, and does precision need to stay full resolution for the whole window?
  • How stale can a dashboard be before it's a problem? Can an alert evaluation skip a handful of points without meaningful impact?
  • Is the scope limited to numeric metrics, or does this platform also need to handle logs and distributed traces?
  • When a rule fires, how does the alert reach a person? Does the platform need to group related alerts or support temporary silencing?

Scale to anchor your design

Work from the following rough numbers:

  • ~50,000 hosts, each running several services
  • Each service emits a few hundred distinct metric names every 10 seconds
  • Labels attached to each measurement include at minimum: host identifier, service name, and deployment version

Work out the implied number of active time series and the platform-wide ingest rate before you pick an architecture — those numbers rule out entire categories of design decisions.


What a strong answer looks like

  • A concretely-shaped data model for a single measurement, with a worked estimate for total active series and ingest throughput
  • A short pipeline sketch (ingest → queue → storage → query → alerts), with an explicit statement of where you're going deep and why
  • For a storage deep-dive: how time-series access patterns drive partitioning, what compression is available on raw point data, and how data is downsampled as it ages
  • For a cardinality deep-dive: what triggers a label explosion, what specific mechanisms catch or prevent it, and what design decisions bound cardinality by topology rather than user-space identifiers
  • For an alerting deep-dive: how evaluation stays both timely and correct as rule and series counts grow, and how missing data points are handled without producing false positives or false negatives

Hints

Hint 1

Start by estimating total active series — 50,000 hosts × hundreds of metrics × a handful of label dimensions multiplies fast. Write that number down before designing anything; it's the single biggest constraint on your storage and query choices.

Hint 2

A label whose value comes from user-facing identifiers (request IDs, user IDs, raw URLs) can silently multiply your series count by orders of magnitude. Cardinality control isn't just a nice-to-have — it determines whether the system stays operational.

Hint 3

When evaluating alert rules, distinguish between 'this series reported zero' and 'this series sent nothing at all.' Treating absent data as a zero makes every ingestion outage look like a sudden drop in errors, which is exactly the wrong behavior.