PromQL Query Builder & Explainer
Build Prometheus queries, explore common PromQL examples, explain query components, and review syntax diagnostics and common pitfalls in one browser-based workspace.
Build, explain and troubleshoot PromQL
Browser-based PromQL workspaceGenerate queries from common building blocks, explore templates, inspect explanations and review static diagnostics before using a query in Prometheus.
Build a query
Compose metric selectors, label filters, range functions, and aggregations.
Use a metric that exists in your Prometheus environment (e.g., http_requests_total, node_cpu_seconds_total).
2. Label matchers
Filter series by exact match (=, !=) or regex (=~, !~).
No label filters configured. Click + Add matcher to narrow the selected series.
Comma-separated label names.
Start from a common query
Load curated PromQL patterns for HTTP traffic, node resources, targets, and SLOs.
No templates match that search.
Explain any PromQL expression
Edit the query on the right. The explanation and static checks update from the current expression.
Component Breakdown
Static diagnostics
Generate an alert-rule draft
Creates a YAML rule draft for a common HTTP 5xx error ratio. Review the metric labels, expression and threshold before deployment.
0.05 means 5% error rate.
This is a template, not a verified production alert. Ensure your counter's status label and series semantics match the expression; validate the YAML with your Prometheus version.
PromQL editor
Syntax highlighting, autocomplete and parser diagnostics
Parser diagnostics validate syntax only. They cannot confirm that a metric or label exists, that the query returns data, or that it is efficient for your environment.
Query review
Syntax feedback
Use the editor's parser diagnostics to spot malformed expressions before testing them against Prometheus.
Rule-based warnings
Heuristics highlight common pitfalls, but a warning is not always an error and an empty warning list does not guarantee correctness.
Copy and adapt
Copy a query into Prometheus or Grafana and validate it with your actual metric names, labels, scrape interval and data.
Important: This workspace builds and reviews PromQL locally in your browser. It does not connect to your Prometheus server, inspect your metrics, execute queries or guarantee alert correctness. Always validate generated expressions against your own instrumentation and Prometheus version.
Fast to use
Designed to help you complete the task without unnecessary steps.
Works in your browser
No separate desktop software is needed for this online tool.
Simple workflow
Enter your information, use the tool and work with the result.
What Is a PromQL Query Builder?
A PromQL query builder is a tool for creating expressions in Prometheus Query Language, the query language used to select and calculate values from Prometheus time-series metrics. It can help developers construct metric selectors, label matchers, range functions and aggregations without assembling every expression from memory.
AabiTech combines a visual query builder with a PromQL editor, reusable examples, a query explainer and selected rule-based diagnostics. It is intended as a practical companion to Prometheus documentation and your monitoring environment, not a replacement for testing queries against real data.
How to Build a PromQL Query
- Enter a metric name that is available in your Prometheus server.
- Add label matchers such as
job="api"orstatus=~"5.."to select the relevant series. - Choose a range function such as
rate()when working with a counter over a time window. - Select an aggregation such as
sumand specify grouping labels when needed. - Review the generated PromQL, read its explanation and check parser diagnostics.
- Run the query in your own Prometheus or Grafana environment and verify the returned series.
Metric names, labels and suitable range windows depend on your instrumentation, scrape interval and monitoring goal.
Explain a PromQL Query in Plain English
The explainer identifies recognized metric selectors, functions, aggregation patterns and range windows, then describes their usual purpose in plain language. This is useful when reviewing a query written by a teammate, learning PromQL syntax or understanding a monitoring dashboard.
Explanations are static and pattern-based. Complex nested expressions, experimental functions, newer language features and environment-specific semantics may not be described completely. A readable explanation does not prove that a query is valid for your metric data or produces the intended result.
PromQL Syntax Validation and Common Pitfalls
The editor integrates a PromQL language extension for syntax highlighting, autocomplete and parser diagnostics. Additional static checks flag selected patterns, including potentially incorrect rate/aggregation order, classic histogram queries that may not preserve the le label, broad regular-expression matchers and example metric names.
Static checks are advisory. Some flagged patterns may be intentional, and a query with no warnings can still be incorrect, expensive or incompatible with the labels in your environment. For definitive validation, use a Prometheus server with the same version and relevant data as production.
Using rate(), increase() and irate()
rate() estimates the per-second average rate of increase of a counter over a range and is commonly used for request rates. increase() estimates the total increase over a range. irate() calculates an instant rate from the last two samples and can be more volatile.
For counters, apply rate() or increase() to each series before aggregating so counter resets can be handled per series. Choose a range that provides enough samples for your scrape interval and desired responsiveness.
PromQL Aggregation and Grouping Labels
Aggregators such as sum, avg, min, max and count combine values across input series. The by(...) modifier retains the specified label dimensions, while without(...) aggregates while excluding the named labels.
Choose grouping labels based on the question you need to answer. Grouping by high-cardinality labels can produce many output series, while removing important dimensions may hide differences between services, instances or endpoints.
PromQL Histogram Quantile Queries
For classic Prometheus histograms, histogram_quantile() commonly operates on bucket rates while preserving the le bucket label. A typical p95 pattern is histogram_quantile(0.95, sum by (le, job) (rate(http_request_duration_seconds_bucket[5m]))).
Replace the example metric and grouping labels with the ones your application exposes. Native histograms have different query considerations, so do not assume that every histogram metric uses classic bucket series.
Prometheus Query Examples and Templates
The template library includes common patterns for HTTP request rates, 5xx error ratios, histogram latency percentiles, CPU and memory utilization, filesystem usage, unavailable scrape targets, Kubernetes container restarts, firing alerts and top-valued series.
Templates are starting points, not universal drop-in queries. For example, an HTTP error query assumes an appropriate status label, while Node Exporter and Kubernetes examples assume their respective exporters and metric names are present. Adapt selectors and exclusions to your own environment.
Generate Prometheus Alert Rule YAML
The alert helper generates a draft YAML rule for a common HTTP 5xx error-ratio scenario. You can set the alert name, metric, threshold, evaluation window, grouping labels and description, then copy the draft for review.
The output is a template and is not automatically validated against your metric schema, Prometheus version or alerting policy. Confirm that the status label and counter semantics are correct, test the expression, validate the YAML and review the alert's behavior before deploying it.
Vector Matching, Labels and Query Results
PromQL binary operations between instant vectors match series using their labels unless modifiers such as on(...), ignoring(...), group_left or group_right change the matching behavior. Unexpected label sets can lead to empty results or many-to-many matching errors.
A static browser tool cannot inspect your actual label sets. When a query returns no data or a vector-matching error, compare the labels on both sides of the expression in Prometheus, then adjust the matching modifiers only when the intended relationship is clear.
Browser Processing, Privacy and Limitations
The builder, static explanations and local diagnostics operate in the browser. The tool does not need a Prometheus connection to construct a query and does not execute the expression against a monitoring server.
The PromQL editor's core language features are configured for offline use; remote metric autocomplete is not enabled. As with any website, normal page requests and hosting infrastructure may process standard connection data. Do not paste credentials, tokens or confidential query information into any online tool unless you are comfortable with the site's applicable privacy terms.
Troubleshooting Common PromQL Problems
- No data: verify the metric name, label values, time range and scrape status.
- Unexpected aggregation: review
byandwithoutlabels and check whether important dimensions were removed. - Counter rate looks wrong: apply
rate()before aggregation and use a suitable range window. - Histogram percentile is incorrect: check the metric type and preserve
lefor classic histograms. - Many-to-many matching error: inspect the labels on both sides of a binary vector operation.
- Slow query: narrow selectors where possible and review range duration, series cardinality and aggregation choices.
These checks guide investigation; the actual cause must be confirmed against the target Prometheus environment.
Questions & answers
Frequently Asked Questions
What is PromQL?
Can I build PromQL queries without knowing the syntax?
Can this tool explain an existing PromQL query?
Does the tool validate PromQL syntax?
Does the query builder connect to my Prometheus server?
Why does a valid PromQL query return no data?
What is the difference between rate() and increase()?
When should I use irate() instead of rate()?
Why should rate() usually come before sum()?
How do I write a p95 latency query in PromQL?
What does the le label mean in histogram queries?
What does sum by (job) do?
What causes a many-to-many matching error?
Can I generate Prometheus alert rules?
Are the query templates guaranteed to work in my environment?
Does the tool send my queries to an AI service?
Can this tool tell me whether a metric exists?
How do I make a PromQL query faster?
Is PromQL the same as SQL?
Can beginners learn PromQL with this tool?
Same category
Related tools
RAG Chunking Simulator & Visualizer
Compare RAG text chunking strategies, visualize chunk boundaries and overlap, inspect chunk sizes, estimate token usage and embedding costs, and export chunks for retrieval-augmented generation workflows.
Requirements.txt to pyproject.toml Converter
Convert Python requirements.txt dependencies into a pyproject.toml project configuration with build-system settings, project metadata, and dependency warnings.
Base64 Encoder & Decoder
Free online Base64 encoder and decoder with UTF-8 and URL-safe Base64 support. Encode text to Base64 or decode Base64 back to readable text directly in your browser.
HTML Beautifier
Format, beautify, pretty print and minify HTML online with customizable indentation, wrapping and whitespace options.
Terraform & OpenTofu State Visualizer
Visualize Terraform (.tfstate) and OpenTofu state files online into interactive architecture diagrams, dependency graphs, Mermaid.js code, and Draw.io XMLâ100% client-side with automatic secret masking.
JSON to Pydantic Converter
Convert JSON data into Python Pydantic models with nested types, optional fields, and Pydantic v1 or v2 syntax.
More from AabiTech
Browse other categories
Explore more AabiTech tools
Browse the complete collection of practical online tools for development, text, design, calculations and everyday digital work.