DevTools Logo

PromQL Query Builder

PromQL Query Builder

Compose Prometheus queries from a form — selectors, rate functions, aggregations, and offsets.

Metric & labels

Range function & window

Aggregation

Offset

Shifts the selector back in time, e.g. compare now to one hour ago.

Generated PromQL

sum by (status) (rate(http_requests_total{method="GET"}[5m]))
client-side
no network
PromQL subset

Examples

HTTP request rate by status code

Input
metric: http_requests_total
matchers: job="api"
range function: rate, window: 5m
aggregation: sum by (status)
Output
sum by (status) (rate(http_requests_total{job="api"}[5m]))

The form composes a metric selector, a label matcher, a range function with a window, and an aggregation into valid PromQL in the correct order.

About this tool

PromQL Query Builder composes Prometheus queries by filling in a form instead of typing the fiddly syntax by hand. Pick a metric name, attach label matchers with the right operator (=, !=, =~, !~), choose a range function such as rate or increase plus a window, and wrap the result in an aggregation like sum by (status) or topk. The expression updates live as you build, and warnings flag the classic mistakes — a rate without a range vector, a topk without its k, or a by modifier with no labels.

The tool only composes text: it does not execute queries, connect to a Prometheus server, or guess metric names. The finished expression is copied into Grafana panels, Prometheus queries, or Alertmanager rules. Everything runs client-side — no data leaves your browser and there is no signup.

How to use

  1. Choose a metric and selectors

    Type the metric name (for example http_requests_total) and add label matchers with the exact operator you need — =, !=, =~ or !~.

  2. Add a range function

    Pick rate, increase or avg_over_time and set the window so the function operates on a range vector like [5m].

  3. Aggregate and copy

    Choose sum/avg by (...) or topk with its k value, read the live expression, and copy it into Grafana, Prometheus, or an alert rule.

Use cases

Grafana dashboard panels

Assemble the selector-plus-rate query that feeds a chart, then paste the result straight into a panel's query box.

Alerting rules

Build the expression behind an Alertmanager alert without fumbling the range-vector syntax.

Teaching and reviewing PromQL

Show how selectors, functions, and aggregations compose by changing one form field at a time.

Common mistakes

Mistake:Forgetting the range window on a function.

Fix:rate, increase and avg_over_time need a range vector — always add a window like [5m], or Prometheus rejects the query.

Mistake:Using the wrong label-match operator.

Fix:Pick consciously between = (equals), != (not equals), =~ (regex) and !~ (regex-not); the builder validates =~ / !~ patterns for you.

Mistake:Expecting the tool to run the query.

Fix:It composes text only — copy the expression into Grafana, Prometheus, or your alerting rules, where your server actually evaluates it.

Frequently asked questions

References & standards