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]))Examples
HTTP request rate by status code
metric: http_requests_total
matchers: job="api"
range function: rate, window: 5m
aggregation: sum by (status)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
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 !~.
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].
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
Related guides
A Practical PromQL Guide: Selectors, Rates, and Aggregations
Compose Prometheus queries with confidence — metric selectors, label matchers, rate/increase windows, and sum by / topk aggregations, with the mistakes that break a query.
Prometheus Alerting Rules, Demystified
How groups, alerts, expressions, for-durations, labels, and annotations compose in a Prometheus rules file.
References & standards
Related tools
.htaccess Generator
Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth
Ansible Playbook Generator
Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML
Apache Config Generator
Build an Apache 2.4 VirtualHost — ServerName, DocumentRoot, Directory, aliases, and optional SSL
CHANGELOG Generator
Write a clean, consistent CHANGELOG entry in the Keep a Changelog format from grouped Added, Changed, Deprecated, Removed, Fixed, and Security notes
Chmod Calculator
Calculate Linux file permissions (777, 755 etc) easily.
CircleCI Config Generator
Generate a .circleci/config.yml — jobs with Docker images and run steps wired into a workflow