node_exporter
node_exporter copied to clipboard
powersupplyclass metrics have missing and non-base units
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.
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?
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.