Prometheus Query Builder Online – PromQL Tester, Validator & Alert Generator – Free | 8gwifi.org

Free Prometheus Query Builder & PromQL Tester

Build, test, and visualize Prometheus queries with live validation and time-series charts


Prometheus & PromQL FAQs

When should I use rate, irate, or increase?
Use rate() for stable per-second rates, irate() for instantaneous rates on spiky series, and increase() for total change over the range.
How do group aggregations work?
Use sum/avg by(...) to keep grouping labels; for binary ops use on()/group_left/right with ignoring/without to control label matching.
How do I reduce high cardinality?
Pre-aggregate with recording rules, drop unneeded labels, and avoid wildcard-heavy matchers in hot paths.

πŸš€ Professional Prometheus Query Builder

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.

Common Metrics:
CPU
Memory
Network RX
Network TX
Disk I/O
Container CPU
Container Memory
HTTP Requests
PromQL Functions:
rate()
irate()
sum()
avg()
max()
min()
count()
topk()
bottomk()
histogram_quantile()
increase()
delta()
round()
abs()
ceil()
floor()
PromQL Query Editor
Time-Series Visualization
Query Results (JSON)
No results yet. Execute a query to see results.

Alert Rule Builder

Generated Alert Rule (YAML)
Configure the alert above and click "Generate Alert Rule"
Query Templates Library

Click any template to load it into the query editor

Query History

Your recent queries (stored locally)

No query history yet

PromQL Help & Documentation

πŸ“š Introduction to PromQL

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.

πŸ” Basic Query Structure

metric_name{label="value"}

Example: http_requests_total{method="GET"}

βš™οΈ Selector Types

Selector Description Example
= Equals method="GET"
!= Not equals status!="500"
=~ Regex match status=~"5.."
!~ Regex not match path!~"/admin.*"

πŸ“Š Aggregation Functions

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)

πŸ“ˆ Rate & Counter Functions

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

πŸ”§ Time Range Vectors

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

🎯 Histogram Functions

Function Description Example
histogram_quantile() Calculate percentiles (P50, P95, P99) histogram_quantile(0.95, rate(http_duration_bucket[5m]))

βž• Operators

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

πŸ”— Aggregation Modifiers

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)

πŸ’‘ Common Patterns

Calculate Percentage:

(metric_used / metric_total) * 100

Example: (node_memory_used / node_memory_total) * 100

Calculate Error Rate:

sum(rate(errors[5m])) / sum(rate(requests[5m])) * 100

Calculate Requests per Second:

rate(http_requests_total[5m])

Calculate 95th Percentile Latency:

histogram_quantile(0.95, rate(http_duration_bucket[5m]))

⚠️ Best Practices

  • Always use rate() with counters - Counters reset on restart, rate() handles this
  • Choose appropriate time ranges - At least 4x your scrape interval (e.g., if scrape is 15s, use [1m])
  • Use by() for aggregation - Be explicit about which labels to group by
  • Avoid high cardinality labels - Don't use user IDs, email addresses as labels
  • Use recording rules for expensive queries - Pre-calculate frequently used queries
  • Filter early in the query - Apply label filters first to reduce data processed

πŸ“– Additional Resources


Features

  • PromQL Query Editor: Professional editor with syntax highlighting for building Prometheus queries
  • Syntax Validation: Real-time validation of PromQL expressions with detailed error messages
  • Time-Series Chart: Interactive Chart.js visualization with configurable time ranges and resolution
  • Alert Rule Generator: Visual builder for Prometheus alert rules with YAML export
  • 70+ Templates: Pre-built query templates for CPU, memory, network, disk, containers, databases, Redis, JVM, and more
  • Query History: Automatically saves your recent queries in browser LocalStorage
  • Common Metrics: Quick-select chips for popular metrics (CPU, memory, network, containers)
  • PromQL Functions: Quick-insert buttons for rate(), sum(), avg(), histogram_quantile(), and 12 more functions
  • Help & Documentation: Comprehensive PromQL guide with functions, operators, and best practices
  • Export Options: Download queries, alert rules (YAML), and Grafana dashboard JSON
  • Mock Data: Generates realistic time-series data for testing queries
  • Copy & Download: Easy export options for all outputs
  • Client-Side: 100% browser-based processing, no server required

Support This Free Tool

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.

500K+ users
200+ tools
100% private
Privacy Guarantee: Private keys you enter or generate are never stored on our servers. All tools are served over HTTPS.