Search code examples
prometheus

Is there a way to use a Prometheus counter with a holt_winters function call?


In the Prometheus documentation it describes the holt_winters() function that can be used generate a smoothed curve.

However the documentation states it should only be used with Gauges. (Obviously I could use it with a counter bu then I just get a smoothed line that is always going up, not terribly useful)

I would like to leverage the holt_winters() function against a counter like http_request_total.

Something like;

holt_winters(rate(http_request_total[5m])) by (path)

Is this possible? Or is there a better way to approach this?


Solution

  • You need to use a recording rule to store the result of the rate, see https://www.robustperception.io/composing-range-vector-functions-in-promql/