I am trying to understand why prometheus is displaying the number of restarts as a decimal. If I have a query like: delta(kube_pod_container_status_restarts_total[2d]) >= 1
which shows number of restarts over a long duration the result is:
value
11.135802469135804
2.0408163265306123
2.2
3 pods restarted 1 or more times in the last 2 days. However they restarted a non-integer amount of times? Increasing the duration out further to 4 days doesnt change the values.
From the Prometheus documentation of the delta()
function:
The delta is extrapolated to cover the full time range as specified in the range vector selector, so that it is possible to get a non-integer result even if the sample values are all integers.
So, it seems to be about the match between your range selector (2d
) and the metric timestamps. If they don't line up, you get fractional values.