I have a gift-certificates application that increases Prometheus counter whenever someone activates a certificate.
Now I want to put simple number in Grafana board that shows me how many certificates were activated last 24h.
I can do that by increase(gift_certificates_activated_total[24h]) query, but it gives float results, something like 105.01287565915334.
But what I found is if I use changes function, it gives me the exact integer result. Query is: changes(gift_certificates_activated_total[24h]) and it shows exactly 105.
Docs says
For each input time series, changes(v range-vector) returns the number of times its value has changed within the provided time range as an instant vector.
As far as I understood, that it's suitable for gauge metric types to get the number of changes of gauge metric value, not for counter. But it seems to work fine with counters too. It shows the same result as floor(increase(gift_certificates_activated_total[24h])) query.
Is it appropriate usage of changes() function?