Prometheus

Data Model & PromQL

Master the label-based time-series model and the query language that makes it powerful.

Every Prometheus time series is uniquely identified by a metric name plus a set of key/value labels — for example http_requests_total{method="GET", code="200"}. Labels are the core dimension: they let you slice and aggregate the same metric across endpoints, instances, or status codes. Four metric types structure how you read them: counters (monotonic totals), gauges (values that go up and down), histograms (bucketed distributions), and summaries (client-side quantiles).

A spreadsheet where every row is tagged with several columns; PromQL is the pivot-table engine that lets you group by any column and compute rates or percentiles on the fly.

Key Concepts

1
PromQL is the query language over this model. You select series with matchers, apply functions like rate() to turn a counter into a per-second rate, then aggregate with operators like sum by (...) or histogram_quantile() to get percentiles. The combination — rate over a range, then aggregate by labels — is the backbone of nearly every dashboard and alert. Understanding counters vs gauges and why you almost always rate() a counter is the most common interview point.