Build, test, and visualize Prometheus queries with live validation and time-series charts
Build PromQL queries visually with quick-insert function buttons, test with mock data, generate alert rules, and export to YAML or Grafana. Includes 70+ query templates for common monitoring scenarios, comprehensive PromQL documentation for beginners, and smart function insertion with templates.
No results yet. Execute a query to see results.
Configure the alert above and click "Generate Alert Rule"
Click any template to load it into the query editor
Your recent queries (stored locally)
No query history yet
PromQL (Prometheus Query Language) is a powerful functional query language for querying time-series data. It allows you to select, aggregate, and compute on time-series data in real-time.
metric_name{label="value"}
Example: http_requests_total{method="GET"}
| Selector | Description | Example |
|---|---|---|
= |
Equals | method="GET" |
!= |
Not equals | status!="500" |
=~ |
Regex match | status=~"5.." |
!~ |
Regex not match | path!~"/admin.*" |
| Function | Description | Example |
|---|---|---|
sum() |
Sum of all values | sum(http_requests_total) |
avg() |
Average of all values | avg(node_cpu_seconds_total) |
max() |
Maximum value | max(memory_usage_bytes) |
min() |
Minimum value | min(memory_usage_bytes) |
count() |
Count of all values | count(up == 1) |
topk() |
Top K elements | topk(5, http_requests_total) |
bottomk() |
Bottom K elements | bottomk(3, disk_free_bytes) |
| Function | Description | Use Case |
|---|---|---|
rate() |
Per-second average rate of increase | Use for alerting and graphing slow-moving counters |
irate() |
Instant rate of increase (last 2 points) | Use for volatile, fast-moving counters |
increase() |
Total increase over time range | Calculate total requests in a time window |
delta() |
Difference between first and last value | Use with gauges to see change over time |
idelta() |
Difference between last 2 samples | Instant change in gauge values |
Syntax: [duration]
Time units: s (seconds), m (minutes), h (hours), d (days), w (weeks), y (years)
Example: rate(http_requests_total[5m]) - Calculate rate over last 5 minutes
| Function | Description | Example |
|---|---|---|
histogram_quantile() |
Calculate percentiles (P50, P95, P99) | histogram_quantile(0.95, rate(http_duration_bucket[5m])) |
| Operator | Type | Example |
|---|---|---|
+, -, *, /, %, ^ |
Arithmetic | memory_used / memory_total * 100 |
==, !=, >, <, >=, <= |
Comparison | cpu_usage > 0.8 |
and, or, unless |
Logical | up == 1 and rate(requests[5m]) > 10 |
by - Group by specified labels
sum(http_requests_total) by (status_code, method)
without - Group by all labels except specified ones
sum(http_requests_total) without (instance)
(metric_used / metric_total) * 100
Example: (node_memory_used / node_memory_total) * 100
sum(rate(errors[5m])) / sum(rate(requests[5m])) * 100
rate(http_requests_total[5m])
histogram_quantile(0.95, rate(http_duration_bucket[5m]))
Every coffee helps keep the servers running. Every book sale funds the next tool I'm dreaming up. You're not just supporting a site β you're helping me build what developers actually need.