Prometheus
Prometheus is an open-source monitoring system and time-series database. It periodically scrapes numeric metrics from your services over HTTP, stores them as time series on local disk, lets you query them with a language called PromQL, and evaluates alert rules that fire notifications when something goes wrong. It started at SoundCloud, was the second project to join the Cloud Native Computing Foundation after Kubernetes, and has become the default way to monitor cloud-native systems.
The properties that matter:
- Dimensional data model: Every time series is a metric name plus a set of key-value labels, like
http_requests_total{service="checkout", method="POST", status="500"}. You slice and aggregate by any label at query time. - Pull-based collection: Prometheus discovers targets and scrapes their
/metricsendpoints on an interval, instead of services pushing data to it. - Self-contained server: One binary handles service discovery, scraping, storage, querying and rule evaluation, with no dependency on a distributed database. That makes it reliable during outages, exactly when you need it.
- Metrics only: Prometheus stores numbers, not logs or traces. It's built for aggregate questions ("what's the p99 latency of checkout?"), not per-request detail.
- An ecosystem around it: Exporters expose metrics from systems you don't control, Alertmanager routes alerts, Grafana draws dashboards, and OpenTelemetry standardizes how applications emit telemetry in the first place.
In interviews, Prometheus shows up in two ways. When you're asked to "design a metrics and monitoring system," its architecture is the blueprint most interviewers expect you to know: pull vs push, a time-series storage engine, an inverted index over labels, and the cardinality problem. And in any other design, "how would you monitor this?" is a standard closing question, where naming the right metrics, alerts and tools signals operational maturity. See /system-design/metrics-monitoring for the full problem breakdown.
The Data Model
A time series is uniquely identified by its metric name and its full set of labels. Each series is a sequence of samples: a millisecond timestamp and a 64-bit float value.
http_requests_total{service="checkout", method="POST", status="200"} @t1 10432
http_requests_total{service="checkout", method="POST", status="200"} @t2 10519
http_requests_total{service="checkout", method="POST", status="500"} @t1 12
Those are two different series, because their status labels differ. Change any label value and you've created a new series.
Services expose their current values in a plain-text format at /metrics:
# HELP http_requests_total Total HTTP requests handled.
# TYPE http_requests_total counter
http_requests_total{method="POST",status="200"} 10519
http_requests_total{method="POST",status="500"} 12
# TYPE http_request_duration_seconds histogram
http_request_duration_seconds_bucket{le="0.05"} 8123
http_request_duration_seconds_bucket{le="0.1"} 9870
http_request_duration_seconds_bucket{le="0.5"} 10490
http_request_duration_seconds_bucket{le="+Inf"} 10531
http_request_duration_seconds_sum 612.4
http_request_duration_seconds_count 10531
Prometheus adds target labels like job and instance when it scrapes, so the same metric from 200 pods becomes 200 distinct series.
Metric Types
Client libraries offer four types, and choosing the right one is a common interview detail:
- Counter: a value that only goes up (and resets to zero when the process restarts). Requests served, errors, bytes sent. You almost never look at a counter's raw value; you look at its rate.
- Gauge: a value that goes up and down. Memory in use, queue depth, active connections, temperature.
- Histogram: counts observations into configurable buckets (requests faster than 50 ms, 100 ms, 500 ms...), plus a sum and a count. Because buckets are counters, histograms from many instances can be added together and then turned into percentiles at query time. Newer versions also support native histograms with automatically chosen, high-resolution buckets.
- Summary: computes quantiles (p50, p99) inside the client. Cheap to query, but quantiles can't be aggregated across instances; averaging the p99 of 50 pods doesn't give you the overall p99.
If asked how you'd measure p99 latency across a fleet, say histogram, not summary, and explain why: bucket counts add across instances, precomputed percentiles don't. The trade-off is that a histogram's accuracy depends on its bucket boundaries, so put buckets close together around your SLO threshold.