`topk(5, ...)` shows more than 5 series on a graph
BeginnerTroubleshootingPromQL and recording rules
Answer
Likely causes → topk is evaluated per step in a range query, so different series win at different times.
Diagnose → Run as an instant query; you get exactly 5.
Fix → For a stable set, pick the top 5 over the whole range with a variable, or use topk(5, avg_over_time(...[$__range])) as an instant query in a table panel.
Prevent → Explain this in the panel description; it surprises everyone once.
More on PromQL and recording rules
A PromQL query in the UI returns `Empty query result` for a metric you can see on `/metrics`Beginner`rate(http_requests_total[1m])` returns nothing but `http_requests_total` has dataBeginner`rate()` applied to a gauge shows huge spikesBeginnerBinary operation fails: `many-to-many matching not allowed: matching labels must be unique on one side`Advanced`found duplicate series for the match group {pod="api-1"} on the right hand-side of the operation`IntermediateError ratio query returns no data during quiet hoursIntermediate