prometheus-query-patterns

Provides PromQL query patterns for rates, percentiles, aggregations, and alerting rules.

Updated Dec 29, 2025
One-click install
npx skills add https://github.com/snoodleboot-io/discrecontinual_equations --skill prometheus-query-patterns-snoodleboot-io
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: prometheus-query-patterns
Source: https://github.com/snoodleboot-io/discrecontinual_equations/tree/main/.claude/skills/prometheus-query-patterns
Command: npx skills add https://github.com/snoodleboot-io/discrecontinual_equations --skill prometheus-query-patterns-snoodleboot-io

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing correct PromQL queries is error-prone: engineers often misuse counters without rate(), pick wrong time windows, or over-aggregate and lose critical dimensions. This Skill provides a reference of proven Prometheus query patterns covering the RED method, SLO tracking, and alerting rules. ## Core Features & Use Cases - Fundamental Operators: Ready-to-use patterns for rate(), histogram_quantile(), and sum() aggregations with label filtering. - RED Method Implementation: Complete Rate, Errors, and Duration queries for HTTP service monitoring, including error-rate percentage calculations. - Alerting & SLO Examples: YAML alert rule templates for high error rates and latency, plus availability and error-budget burn calculations. - Use Case: You need to build a dashboard and alerts for a new API service. Use this Skill to get the correct P95 latency query, error-rate ratio, and alert rule definitions without guessing PromQL syntax. ## Quick Start Ask for the PromQL query to calculate the 95th percentile latency and error rate for your HTTP service, and get a ready-to-use alert rule.

Frequently Asked Questions about prometheus-query-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I calculate requests per second in PromQL?▼

Use rate(http_requests_total[5m]) to get per-second request rate over a 5-minute window. Aggregate across services with sum(rate(http_requests_total[5m])) or group by labels like sum by (service) (rate(...)).

How to calculate P95 latency with Prometheus histograms?▼

Use histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m])) to compute the 95th percentile latency. Always apply rate() to the bucket counters before passing them to histogram_quantile.

How do I write an error rate alert in Prometheus?▼

Divide the 5xx error rate by total rate: sum(rate(http_requests_total{status=~"5.."}[5m])) / sum(rate(http_requests_total[5m])) > 0.01. Wrap it in an alert rule with a for duration like 5m to avoid flapping.

Why should I use rate() instead of raw counter values in PromQL?▼

Counters like http_requests_total only increase, so raw values are meaningless for dashboards and alerts. rate() converts them into per-second values over a time window, handling counter resets correctly.

What time window should I use for Prometheus rate queries?▼

Match the window to your alerting needs: [5m] is standard for dashboards and alerts, while longer windows like [1h] or [30d] suit availability calculations. Too-short windows produce noisy results.