Replies: 3 comments 2 replies
-
Electricity usage is usually shown as the total amount of energy (measured in kilowatt-hours or kWh) used during a specific time, like a day, a month, or a year. The way this information is presented can be customized to suit the needs and preferences of the user or organization. You can get details like how much electricity was used in each hour, the total for a day, average for a month, and more, depending on how detailed or in-depth you want to analyze it. In this particular query, it's displaying the electricity usage per day, but you can also choose to view it per hour by using just the first part of the function. However, it's important to note that the second part of the function doesn't extrapolate the data to show it for the entire day. Actually, this function was created to fix the issue that you are describing, since the previous functions were just simply multiplying by 24 hours. The first part of the function counts how many data samples are collected within a 24-hour period, while the second part counts the number of samples collected within a 1-hour period. This is important because, depending on how often Prometheus collects data (scrape interval), the number of samples can vary. Let's say a workload has 10 data samples within 1 hour, and it runs for 5 hours (as you mentioned in your example). The first part of the function would show 50 samples. When you divide the first part by the second part, you get 5 hours. This means the kWh for this workload would be multiplied by 5 hours, not extrapolated to 24 hours. |
Beta Was this translation helpful? Give feedback.
-
@marceloamaral , thanks for chiming in, but my point about the incorrectness still stands .. doesn't it?
imagine a graph like this ![]() Wouldn't the query produce |
Beta Was this translation helpful? Give feedback.
-
Closing the discussion based on the correction that got merged. |
Beta Was this translation helpful? Give feedback.
-
This discussion intents to validate the correctness of promqls used in Grafana Dashboard.
A lot of promqls follows the pattern below
IIUC, the above does the following ( please correct me if am wrong)
calculates the
increase
in the absolute values ofkepler_container_package_joules_total
for the last1h
and converts that to kWhnumber of hours
of data that is collected in the last24h
*
)sum
all of values to get a single valueLets we have been measuring for the past 6 hours
The query above would paint a wrong picture of the usage. The value we get will be way higher than the
sum(increase(kepler_container_package_joules_total[6h]))
Thus, should be rely on just the
sum( increase( ...) )
than extrapolating the last 1hr 's consumption?Beta Was this translation helpful? Give feedback.
All reactions