← All problems
Dashboard
Courses
Problems
Badges
Theme
Sign inStart free
Problem 032 · Observability and operations

Design a Metrics Monitoring System

Medium 55 min

Design an internal monitoring system in the style of Prometheus or Datadog. An agent on each of 100,000 hosts reports about 500 metrics (CPU, memory, request rates, custom application counters) every 20 seconds. Engineers build dashboards that query the last hour to the last year, and define alert rules such as 'p99 latency above 500 ms for 5 minutes' that must page the on-call engineer within a minute. The system must stay up during incidents, which is exactly when it is busiest.

Functional requirements

  • Ingest metrics with names and labels (host, service, region) from agents
  • Query and graph metrics over time ranges with aggregations (sum, rate, percentiles)
  • Define alert rules and notify on-call engineers through a paging provider
  • Keep full-resolution data for 15 days and downsampled data for a year

Non-functional requirements

  • Alerts fire within 60 seconds of the condition becoming true
  • Dashboards for the last hour load in under 2 seconds
  • Ingestion keeps up during incidents when metric volume and dashboard use both spike

Constraints and scale

  • 100,000 hosts x 500 metrics every 20 seconds: 2.5 million samples per second
  • Agents batch samples into about 5,000 requests per second
  • 50 million active time series; label combinations must be kept bounded

You will practise

  • Choose a time-series database and understand compression of timestamp and value pairs
  • Separate ingestion, storage, querying and alerting so each scales on its own
  • Use downsampling and retention tiers to control storage cost
Show 3 hints
  1. 2.5 million samples per second is a lot of rows for a general-purpose database. What makes time-series stores different?
  2. Should alert evaluation read from the same store that dashboards query, or from the incoming stream?
  3. What happens to the number of series if someone adds a user ID label?

Ready to build?

Open the canvas, place your components and explain your decisions. Your draft saves automatically.

Sign in to start

Failure scenarios

  • A deploy adds a user ID labelA team ships a change that tags a request counter with the user ID. Within ten minutes the number of active series grows from 50 million to 400 million.

Run them from the workspace once your design is in place.