Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different result using rate(scaph_host_energy_microjoules) and scaph_host_power_microwatts #325

Open
Louan-Robert opened this issue Jun 5, 2023 · 2 comments
Projects

Comments

@Louan-Robert
Copy link

Hello, I am using scaphandre in one of my projects and encountering some problems.

When comparing scaph_host_energy_microjoules and applying prometheus rate() function to scaph_host_power_microwatts, I am getting different results.

image

My understanding is that when applying the rate() function to scaph_host_energy_microjoules metric, the result is a graph in watt. So, the resulting graph should be the same as scaph_host_power_microwatts, but it is not.

Does this mean one of these metrics is more reliable than the other ? If so, which one should I use to monitor a server power consumption ?

Thanks !

@TheElectronWill
Copy link
Contributor

TheElectronWill commented Jun 7, 2023

Without checking the source code, I guess that host_power is the instantaneous power, whereas energy is the amount of energy consumed since the last measurement. The instantaneous power is unprecise, because the actual power varies between two measurements, and that changes the energy consumption. Thus, the energy should be more reliable (even if #280 should be fixed to avoid some small errors in the energy values).

edit: OK so actually the code reads:

/// Returns a Record instance containing the power consumed between
/// last and previous measurement, in microwatts.
pub fn get_records_diff_power_microwatts(&self) -> Option<Record> {

so it's not the instantaneous power, but rather the average power consumed between now and the previous energy measurement. I'm not sure how that compares to the Grafana's rate function?
In any case, if I want to get the energy consumed by the server across a day, a week, etc. I would use sum(energy_microjoules) and convert it to a more human-friendly unit like kWh.

@bpetit bpetit added this to Triage in General Jun 8, 2023
@mmadoo
Copy link
Contributor

mmadoo commented Jun 9, 2023

In our architecture, we use 2 prometheus instances for a better reliability. So having energy between previous measurement can lead to wrong values.
Is there a way to have a counter that gives a cumulative metric value ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
General
Triage
Development

No branches or pull requests

3 participants