Reputation: 85
I have a counter that I am plotting on Grafana.
rate(processed_work_items_total{job="MainWorker"}[1m])
I am not getting the expected numbers in Grafana.
What I want is the # of Work Items Processed per minute.
Is my query wrong? or my Unit of Measure in my Y Axis. I currently have it as ops/min and its giving me a super small number.
Upvotes: 6
Views: 5639
Reputation: 18010
If you need to calculate per-minute increase rate for a counter metric, then use increase(...[1m])
. For example, the following query returns the increase of processed_work_items_total{job="MainWorker"}
time series over the last minute:
increase(processed_work_items_total{job="MainWorker"}[1m])
Note that the increase()
function in Prometheus may return unexpected results due to the following issues:
These issues are going to be addressed in Prometheus according to this design doc. In the mean time it is possible to use MetricsQL, which is free from these issues.
Upvotes: 0
Reputation: 13021
According to the documentation, rate(processed_work_items_total{job="MainWorker"}[1m])
will calculate the number of work items processed per second, measured over the last one minute (that's the [1m]
from your query).
If you want the number of items per minute, simply multiply the above metric with 60.
Upvotes: 4