Basic PromQL Querying

All Topics

Vector Matching

Vector Matching

Binary operations between two vectors match series by labels. PromQL automatically pairs series with identical label sets from each side, performs the operation, and outputs the result.

Example: average response time. Divide the rate of total request duration by the rate of request count:

  rate(http_request_duration_seconds_sum{job="demo"}[5m])
/
  rate(http_requests_total{job="demo"}[5m])

PromQL matches series with the same labels (instance, method, status, path) and divides them pairwise. The metric name is ignored for matching and dropped from the result.

When labels don't match exactly, the operation fails silently. Unmatched series are simply dropped from the output. You need explicit matching modifiers to handle this.