Lesson 1 of 9 · 21m
The Time Series Model: Samples, Labels, and Identity
Why every Prometheus series is just a name plus a label set, why labels are identity rather than decoration, and how this one idea explains most operational behavior.
Prometheus has no tables, documents, spans, or events. It has time series: a metric name, a set of key-value labels, and samples of (timestamp, value). That sounds simple because it is — and because almost every painful incident in a metrics pipeline is someone violating the consequences of that simplicity.
A series is its entire identity
http_requests_total{job="api", instance="10.4.2.17:8080", method="GET", path="/health", status="200"} 104223The series above is not "the API request counter." It is one exact counter for one exact combination of labels. Change any label value — even one you consider unimportant — and Prometheus treats it as a different series with its own history.
This is why rename migrations hurt, why restarting on a new pod identity creates a new instance, and why putting a user ID into a label is catastrophic. Prometheus does not know these series are related unless your query says so.
Metric types are conventions with consequences
Prometheus client libraries expose four practical types:
# TYPE http_requests_total counter
# TYPE http_request_duration_seconds histogram
# TYPE node_memory_MemAvailable_bytes gauge
# TYPE go_goroutines gauge- Counter: monotonically increasing total. Query with
rate()orincrease(); never graph the raw value except for debugging resets. - Gauge: a value that can rise or fall. Memory, temperature, queue depth.
- Histogram: observations bucketed into cumulative
_bucketseries plus_countand_sum. - Summary: client-side quantiles plus
_countand_sum; cheap to expose, dangerous to aggregate.
The suffixes are conventions, not enforcement — _total, _seconds, _bytes — but follow them. Humans and recording rules depend on predictable units.
Labels select dimensions, not search terms
Good labels are small, controlled, and useful for aggregation:
service="checkout", env="prod", region="iad", code="5xx", outcome="failure"Bad labels are unbounded or duplicates of existing dimensions:
user_id="8f3e...", request_id="b3...", email="alice@example.org", pod_name="api-7d9c4b6d8f-xk2qp"If every value creates a distinct series, you are storing randomness at query time forever. A label should answer "what dimension do I slice by?" not "what detail might be useful someday?"
Scrape identity is part of the data
job and instance are target identity labels added by Prometheus. Service discovery, relabeling, and scrape config decide them. When someone says "the same metric appears twice," usually they mean two targets expose overlapping series or discovery constructed the same instance twice.
Field notes
- High-cardinality labels are not merely expensive — they can turn one deploy into a metrics outage.
- Counters reset when processes restart. Correct PromQL handles resets; dashboards pretending counters never reset mislead during deploys.
- Keep units in metric names: seconds, bytes, ratio. A bare
latencymetric becomes archaeology in six months. - Series with no samples for a while become stale; absent does not mean zero unless you explicitly coerce it.
Was this lesson helpful?