Question: In the Prometheus documentation it describes the [holt\_winters()](https://prometheus.io/docs/querying/functions/#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?

Answer: 
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/>
It is possible to pass [rate()](https://docs.victoriametrics.com/MetricsQL.html#rate) into [holt\_winters()](https://docs.victoriametrics.com/MetricsQL.html#holt_winters) by using [Prometheus subqueries](https://prometheus.io/blog/2019/01/28/subquery-support/):

```
holt_winters(
  (sum(rate(http_request_total[5m])) by (path))[1h:1m], 0.5, 0.5
)

```