Prometheus Query Builder (PromQL Playground)
Learn Prometheus Query Language (PromQL) with an interactive playground. Master label filtering, rate calculations, aggregations, and histogram quantiles with real-time query execution.
Category: Observability
Topics covered: prometheus, promql, observability, sre, metrics, monitoring
// simulator
Prometheus Query Builder (PromQL Playground)
Learn Prometheus Query Language (PromQL) with an interactive playground. Master label filtering, rate calculations, aggregations, and histogram quantiles with real-time query execution.
Learn Prometheus queries interactively. No experience needed, start with tutorials below!
🎯 Your First Query: See All Requests
Learn how to view a metric - think of it like looking at your app's request counter
http_requests_totalThis shows every HTTP request your app has handled. Each row is a different server or endpoint (like api-1, api-2).
🔍 Filter What You See: Only GET Requests
Too much data? Let's narrow it down to just GET requests
http_requests_total{method="GET"}The {method="GET"} part is like a filter - it says "only show me GET requests, ignore POST, DELETE, etc."
🎯 Get Specific: Successful GET Requests
Combine filters to see exactly what you want - only successful (200) GET requests
http_requests_total{method="GET",status="200"}You can stack filters with commas. This shows GET requests that returned a 200 (success) status code.
📈 Speed Matters: Requests Per Second
How fast are requests coming in? Use rate() to see per-second speed
rate(http_requests_total[5m])rate() converts your growing counter into "requests per second over the last 5 minutes". Like checking your car's speedometer!
🧮 Total It Up: All Requests Combined
Add up all servers to get your total request rate
sum(rate(http_requests_total[5m]))sum() adds up all your servers' request rates into one number. Perfect for dashboards!
📊 Break It Down: Requests by HTTP Method
See totals separated by GET, POST, etc.
sum by(method) (rate(http_requests_total[5m]))"sum by(method)" means "give me separate totals for each HTTP method". Like organizing by category!
🚨 Real-World: Error Rate Percentage
What % of requests are failing? This is how SREs monitor health
sum(rate(http_requests_total{status=~"5.."}[5m])) / sum(rate(http_requests_total[5m])) * 100This divides 5xx errors by total requests and converts to %. If you see 2.5, that means 2.5% of requests are failing.
Understanding Prometheus & PromQL
Core concepts
- Time Series: A stream of timestamped values identified by a metric name and labels (key-value pairs).
- Instant Vector: A set of time series with one sample per series at a single point in time.
- Range Vector: A set of time series with multiple samples over a time range (e.g., [5m]).
- Scalar: A simple numeric floating point value.
Common functions
- rate(): Calculate per-second rate over a time range (for counters).
- irate(): Instant rate based on last two samples (more responsive).
- sum/avg/max/min: Aggregation operators across multiple series.
- histogram_quantile(): Calculate percentiles from histogram buckets.
Key concepts
- Counters: Monotonically increasing values (use rate() or increase()).
- Gauges: Values that can go up and down (use directly).
- Histograms: Observations bucketed by value (use histogram_quantile()).
- Summaries: Pre-calculated quantiles (use directly, no histogram_quantile()).
Label matching
=Exact match:method="GET"!=Negative match:status!="500"=~Regex match:path=~"/api/.*"!~Negative regex:job!~"dev-.*"
Try next
// simulator
Agentic Loop Simulator
Watch a coding agent run an agentic loop, one step at a time. A planner, a builder, and a judge cycle through plan, build, verify, and repeat until the goal is met. Toggle the separate judge off to see why an agent grading its own work ships confident bugs. An animation-first, interactive explainer of loop engineering and how it maps to Claude Code.
// simulator
SQL Terminal Simulator
Practice SQL in an interactive browser terminal. Learn SELECT, WHERE, ORDER BY, DISTINCT, aggregates, GROUP BY, HAVING, JOINs, subqueries, and window functions against a small e-commerce schema, with single-table queries evaluated live and verified Postgres output.
// simulator
PostgreSQL Terminal Simulator
Practice the psql tool and Postgres engine in an interactive browser terminal. Explore with meta-commands, read real EXPLAIN plans, add an index to turn a sequential scan into a bitmap index scan, and use BEGIN and ROLLBACK to make changes safe, all against a small e-commerce database with verified PostgreSQL output.