What do `and`, `or` and `unless` do in PromQL?

IntermediateConceptPromQL & Recording Rules
Answer

They are set operators on label sets:

  • a and b: series from a that have a matching series in b.
  • a or b: all of a, plus series from b with no match in a.
  • a unless b: series from a with no match in b.
up{job="api"} == 0 unless on(instance) maintenance_mode == 1

Values come from the left side; b acts as a filter.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on PromQL & Recording Rules