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.

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 this tool

  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

Does the builder execute the query against my Prometheus?

No. It only composes PromQL text — you pick a metric selector, label matchers, a range function and an aggregation, then copy the finished expression into Grafana, Prometheus, or your alerting rules. Nothing is executed and no data is sent anywhere.

Does it support rate, sum by, and topk?

Yes. Range functions like rate and increase are form fields with a window, aggregations such as sum by (...) and avg by (...) take a label list, and topk/bottomk take a k value — all composed in the correct PromQL order with live warnings for mistakes like a rate without a window.

What label-match operators can I use?

All four PromQL matchers: = (equals), != (not equals), =~ (regex matches), and !~ (regex does not match). The builder validates the regex for the =~ and !~ operators so an invalid pattern is caught before you copy the query.

References & standards

.env Secret Safety Linter

Validate .env syntax and spot likely leaked credentials or placeholder secrets.

.htaccess Generator

Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth

2D Fluid Dynamics & Particle Physics Sandbox

A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.

AI Function Calling Schema Generator

Generate function calling JSON schemas from TypeScript interfaces

Algorithm Arena & Data Structure Visualizer

Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.

Ansible Playbook Generator

Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML