Observability

PromQL Query Builder

Build a PromQL query that matches the metric type, so rate() lands on a counter and a quantile reads the histogram buckets.

Metric

Only ever increases, so only its rate is meaningful. This is what decides whether the query needs rate(), the _bucket series, or neither.

rate() needs at least two samples in the window. A common rule is at least four times the scrape interval.

Label matchers

=~ and !~ are fully anchored regular expressions, so 5.. matches a three-character status and needs no ^$.

Aggregation

Comma separated. Every label not listed is collapsed, including the ones saying which instance the number came from.

Alert threshold

A comparison turns the query into an alert expression: it returns only the series that breach the threshold.

Query
instant query
sum by (status, method)(rate(http_requests_total{job="api"}[5m]))
  • InfoA counter only ever increases, so its raw value is the total since process start. rate() converts it to per-second change and handles counter resets across restarts.

Common queries

Built in your browser — no Prometheus is contacted