- It calculates the total CPU hours spent by all the pods in given namespace for chosen time period (say a month). But instead of choosing "actual" value for each 1-minute datapoint, it chooses max value of all the per-minute data point and calculates per hour value by that max * 60.
sum_over_time(
(
60 * (max_over_time(sum(rate(container_cpu_usage_seconds_total{namespace="", pod=~".*", container!=""}[1m]))[1h:1m]))
)[$__range:1h] # sum over the time period choosen (e.g: previous month)
)
- If I don't have to use max in an hour, instead use normal absolute value. I can do something like.
sum_over_time(
sum_over_time(
sum(rate(container_cpu_usage_seconds_total{namespace="", pod=~".*", container!=""}[1m]))[1h:1m])
)[$__range:1h] # sum over the time period choosen (e.g: previous month)
)
is it correct? I belive I don't have / 3600
or anything because here I care about CPU hours.