Logs and observability

PromQL formatterCheck the query before a dashboard does

Paste an expression for local parsing, or switch to sample matching and RE2 testing. The page does not execute time-series queries.

PromQL formatter

PromQL expression

Result

Processed in this browser; no Prometheus connection or query upload.

Options

Enter an expression or load an example.

A dashboard can show no data for many reasons. PromQL formatter helps separate a malformed expression from a selector that simply misses the label values you expected.

Keep the original query visible while checking its structure. The formatter changes spacing only at recognized PromQL boundaries, so you can compare its output with the input before using it elsewhere.

Why use PromQL formatter for query checks

Three related checks, with a clear boundary between syntax and actual data.

See which sample a selector keeps

PromQL formatter applies a pure vector selector to pasted metric lines and reports each match. A status=~"5.." filter can be tried against 500, 200, and 503 without claiming to fetch live series.

A vector selector accepts two pasted metric samples and rejects one by status and job labels

Use Prometheus-style regex matching

An anchored RE2 engine tests label values rather than a JavaScript regex approximation. PromQL formatter rejects unsupported lookarounds instead of quietly giving you a misleading match.

An anchored RE2 pattern matches 500 but rejects 1500 because it tests the whole value

Three checks to run in order

Use the example to learn which result is a parse, a sample match, or a regex match.

01

Parse before comparing labels

Check the whole PromQL expression first. A missing brace or parenthesis is reported at a line and column; an invalid query never becomes downloadable formatted output.

02

Switch to a pure selector

The sample mode accepts a metric selector such as http_requests_total{job="api"}. Paste one metric and its labels per line; optional numeric sample values are ignored.

03

Confirm regex against full values

In RE2 mode, enter a matcher pattern and one value per line. A pattern 5.. matches 500 but not 1500 because Prometheus label regexes match the whole value.

What the local checks can show

The modes answer different questions about a query's text and labels.

PromQL syntax and structure

The PromQL validator parses the query and shows a conservative formatted version plus a syntax tree. Errors stop export and point to the offending line.

Selector matches on pasted data

The PromQL label matcher evaluates =, !=, =~ and !~ together against each local sample, including the empty-string behavior of absent labels.

Anchored RE2 test

PromQL regex uses RE2, so backreferences and lookaround are rejected. A full-string result is shown for each value you supply.

Limits that matter before reuse

These rules prevent a text check from being mistaken for a live query result.

No time-series execution
PromQL formatter has no TSDB or Prometheus API connection. It cannot know whether a metric exists or return a graph, sample value, or query cardinality from your deployment.
Only a vector selector matches samples
The local sample mode does not evaluate rate(), sum by(), joins, offsets, or range queries. Paste a pure vector selector instead; use the PromQL mode to inspect a full expression.
Regexes use RE2 full matching
The regex tester anchors the entire label value and rejects syntax RE2 cannot compile. A JavaScript-only match is never used as a fallback.

PromQL formatter questions from common searches

Short answers about formatting, grouping, labels, and regex behavior.

Can I format a PromQL query online without a server?

Yes. PromQL formatter parses and formats the text in this browser tab. It does not contact a Prometheus instance, so the result cannot confirm that the referenced metrics exist.

What does the PromQL query formatter change?

It adjusts spacing at syntax-tree boundaries and shows a structure view. It keeps the original input; formatting is not an automatic repair for an invalid expression.

How does a PromQL regex match a label value?

Prometheus uses RE2 with a full-string match. In the sample and regex modes, 5.. matches 500, but a substring inside 1500 is not a match.

Does sum by work in the local sample matcher?

The PromQL parser can inspect a sum by expression. The sample matcher only filters metric labels with a pure vector selector; it cannot calculate aggregated values.

How can I check a PromQL label matcher?

Choose the selector mode, paste a vector selector and one metric sample per line, then inspect which labels failed on each nonmatching row.

Found a PromQL edge case we missed?

Try PromQL formatter on your next query

PromQL formatter gives a syntax view, local selector examples, and a real RE2 check before the expression reaches an alert or dashboard.

Copy only a current, valid result; changing input immediately disables export until the new check finishes.