A query is a question made executable. That sounds simple until an incident is under way and someone produces a fluent, impressive query that answers the wrong question. The graph moves, the panel fills, and the team acts on a number nobody can quite explain. Most query disasters are not syntax errors. They are correct computations of the wrong shape.
Prometheus has a full query language, with a reference manual where its functions live. What a practitioner must own is different: the judgment of which shape of computation a question needs, what that shape assumes, and how it can lie. Four patterns carry nearly every operational question: the rate, the ratio, aggregation across a dimension, and the quantile over buckets.
First pattern: the rate
A counter's stored values form a climbing staircase. Nobody's real question is how high the staircase is. The question is how fast it is climbing now: requests per second, errors per minute. The rate pattern answers that over a stated window. It takes the counter's increase across the window, corrects for the resets that restarts cause, and divides by the window's length.
The arithmetic should be within reach for any counter anyone shows you. When a checkout counter rises by 18,000 requests across a 30-minute window of 1,800 seconds, the rate is 18,000 divided by 1,800, which is 10 requests per second. That is not a detail to admire on a dashboard. It is a claim you should be able to do and defend.
The window choice is the judgment inside the pattern. Too short, and the rate jitters with every burst, drawing sawtooth graphs that mean nothing. Too long, and the rate smooths a real spike into a gentle hill and reports calm over an incident. Match the window to the decision's timescale. An alert that must react in minutes cannot be computed over an hour. A capacity review should not twitch at a five-minute window. A rate also needs enough samples inside its window to be honest.
Second pattern: the ratio
Most indicators are one rate divided by another: error rate over request rate, successes over attempts. If a checkout failure counter rises by 900 across the same window in which its request counter rises by 18,000, the failure ratio is 900 divided by 18,000, which is 0.05 — five percent of requests failing.
Ratios are how you compare a busy hour with a quiet one without lying to yourself. A raw error count rises with traffic even when nothing has worsened. But ratios carry one standing danger: the denominator. A ratio computed over a window with almost no traffic divides by nearly nothing and produces theatrical numbers. One hundred percent failure at 4 a.m. can be two requests, both from a health checker.
Every ratio that drives a panel or an alert needs a companion awareness of volume. The ratio says how bad. The rate says how much. A decision usually needs both sentences.
Third pattern: aggregation across a dimension
Series arrive sliced by instance, operation, and store. Decisions are usually about a total or a comparison. Sum across instances for the service's whole traffic. Sum grouped by operation to find which operation owns the errors. Average carefully, and only where the underlying values are the kind that average honestly: levels, not percentiles.
Aggregation is where labels pay their rent. You can only group by what was recorded. It is also where meaning is lost fastest. Aggregating away the instance dimension hides the one drowning instance behind the fleet's health. Aggregating away the result dimension hides failure inside success. The total can look calm while one part of the system carries the whole incident.
The discipline is to aggregate deliberately, for a stated question, and to be able to say which distinction you just threw away and why the question permits it. If you cannot name the discarded dimension, you have not made a decision. You have accepted a default and called the output an answer.
Fourth pattern: the quantile over buckets
Latency questions are answered from histograms. The pattern computes, across the aggregated buckets, the value below which a stated proportion of observations fell. The order is the concept in miniature: aggregate first, then take the quantile. Combine the distributions, then summarize. Never summarize, then combine.
That order matters because a percentile is not a level. Averaging percentiles from separate instances produces a number that describes no population anyone served. Summing the buckets first preserves the underlying observations, so the quantile that follows describes the combined experience.
The gloss comes before the result
Read as a set, the four patterns share one discipline. State the question, the window, the dimension you kept, and the dimension you discarded, every time. A query you cannot gloss in that sentence is a query you do not understand, however impressive its output looks on glass.
This corrects the common misconception that a senior engineer should be able to write the whole query from memory, functions and all, and that needing the reference means not knowing the tool. The reference is where functions live. Judgment is where patterns live. Incidents are not improved by memorized syntax. They are routinely ruined by a fluently written query of the wrong shape: the ratio whose denominator nobody checked, the average of percentiles, the five-minute rate driving a capacity decision.
The professional skill is the gloss: question, window, kept dimension, discarded dimension, stated before the result is trusted. Syntax can be looked up in seconds. The habit of interrogating shape cannot. Ask the data a decision, and the first decision is your own — which computation, over which window, keeping which distinction, and discarding which other one.
Experience it, don’t just read about it
A query is a decision stated as one of four patterns, each glossed by its question, window, and kept and discarded dimensions is Concept 7 of Grafana and Prometheus in Practice (Course No. 576), from Cognosco Learning, a learning company powered by AI. The course builds observability practice beyond this distinction — Labels: Power at a Price — Cardinality and the Series Budget, Percentiles, Not Averages — The Tail Is Where Users Live, and Alert on Symptoms, Not Causes — The Page Must Mean Act Now — each worked through with an Agentic Socratic AI coach, one learner at a time. Try a Free Preview at cognoscolearning.com.
Navigate your own course.
© 2026 Cognosco Learning. All rights reserved.