Expand description
Label matchers and the postings plan they compile to.
A LabelMatcher is the low-level matcher type Prometheus uses: a label
name, a match type and a value. PromQL AST nodes are not represented here —
a query layer converts its own matchers into this type.
Semantics worth calling out, because they decide which series a matcher selects:
- a missing label is treated as the empty string, so
{foo=""}matches series withoutfoo, and{foo!=""}matches only series that have a non-emptyfoo; =~and!~are fully anchored, i.e.=~"a|b"matchesaandbbut notab. Prometheus does the same;=~".*"matches everything and=~".+"matches any non-empty value; both are special-cased in the planner instead of scanning every value.
IndexReader::postings_for_matchers turns a matcher list into a single
lazy postings source, mirroring Prometheus’ PostingsForMatchers: matchers
that must hold are intersected, matchers that exclude are subtracted, and
the choice of “start from all series” is made the same way.
Structs§
- Label
Matcher - A label matcher:
name <op> value.
Enums§
- Match
Type - How a
LabelMatchercompares a label value.