← All notes

PromQL selectors pick series by metric name and label matchers, as instant or range vectors

Answer: An instant vector selector such as http_requests_total{job="api"} selects a set of time series with one sample value each at a given timestamp. Append a duration in square brackets, as in [5m], to get a range vector that selects a range of samples back from the current instant.

Label matching operators

http_requests_total{environment=~"staging|testing|development",method!="GET"}
rate(http_requests_total[5m])
http_requests_total offset 5m

Rules that bite

offset and duration expressions

The offset modifier changes the time offset for individual instant and range vectors in a query. Arithmetic expressions can be used where a time duration is expected, for example [5m * 2]. With offset, wrap a duration expression in parentheses; without them, only the first duration value is used.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Prometheus docs, Querying basics; prometheus/prometheus (GitHub), Querying basics (source page). Apache-2.0 (https://raw.githubusercontent.com/prometheus/prometheus/main/LICENSE). Copyright The Prometheus Authors. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Prometheus docs, Querying basics; prometheus/prometheus (GitHub), Querying basics (source page). Apache-2.0 (https://raw.githubusercontent.com/prometheus/prometheus/main/LICENSE). Copyright The Prometheus Authors.

Cite this

Permanent ID: iil:note:64thp1zg

iinventedlight. 2026. "PromQL selectors pick series by metric name and label matchers, as instant or range vectors." iinventedlight Library, iil:note:64thp1zg, version of 2026-11-18. https://iinventedlight.com/library/notes/prometheus-promql-selectors/. License: CC-BY-4.0.

@misc{iil_note_64thp1zg,
  author = {{iinventedlight}},
  title = {{PromQL selectors pick series by metric name and label matchers, as instant or range vectors}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-18},
  url = {https://iinventedlight.com/library/notes/prometheus-promql-selectors/},
  note = {Permanent ID iil:note:64thp1zg. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/prometheus-promql-selectors.md.