node_exporter icon indicating copy to clipboard operation
node_exporter copied to clipboard

powersupplyclass metrics have missing and non-base units

Open brian-brazil opened this issue 5 years ago • 2 comments

I was researching for a blog post, and noticed some issues with the metrics from the powersupplyclass collector.

Only a few of the metrics have units, e.g. node_power_supply_current_ampere has a unit but many including node_power_supply_current_max are missing units. There's also some units that appear to be incorrect and/or not base units. My laptop doesn't have the metric so I can't be sure, but the unit on node_power_supply_charge_ampere looks to be wrong as it's actually Ah per the kernel docs (https://www.kernel.org/doc/Documentation/power/power_supply_class.txt) - which should be exposed as columbs (i.e. amp seconds). For node_power_supply_energy_watthour should be using the base unit of joules. The capacity metrics are percentages, so should be converted to ratios.

Several labels of node_power_supply_info seem to be able to change over time, including at least capacity_level, status, charge_type and health so should probably be split out into an enum similar.

brian-brazil avatar Aug 21 '20 10:08 brian-brazil

charge_ampere is definitely a confusing name! I don't mind coulombs vs. ampere-hours, but if you add a unit to the metric name (the kernel metric is just called "charge_now"), it should actually be a unit of charge.

Is there an issue with fixing this (backward compatibility or something), or is it just a matter of no one sending a patch yet?

shachaf avatar Mar 11 '24 01:03 shachaf

Technically we have a major version stability guarantee around metric names.

  • Add a "use new names" feature flag.
  • Expose both the old and new names.

But, it's just a matter of someone providing the code change.

SuperQ avatar Mar 11 '24 07:03 SuperQ