`rate()` applied to a gauge shows huge spikes
BeginnerTroubleshootingPromQL and recording rules
Answer
Likely causes → rate() assumes a monotonically increasing counter; every decrease in a gauge is treated as a counter reset, producing big fake increases.
Diagnose → Check # TYPE on the metric's /metrics output.
Fix → For gauges use deriv(), delta(), avg_over_time() or the raw value. Use rate()/increase() only on counters (_total, _count, _sum, _bucket).
Prevent → Follow naming conventions so types are obvious.
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 dataBeginnerBinary 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`histogram_quantile` returns `NaN`Intermediate