Closed tjhop closed 5 months ago
Guess we were under the assumption that it's always the same unit. If not, that's an issue..
No worries, I've opened a PR to fix it :+1:
The humanize
library produces incorrect results, as the kernel is exposing kB
to mean 1024. But the humanize
library kB
means 1000.
Closing since #569 was merged
Hi all :wave:
Is there a reason that the parseMemInfo() function ignores the optional unit field? This can lead to incorrect results on systems that do supply the field, as the units are obviously not adjusted accordingly.
A small example program/output:
meminfo.go
output:
This also looks like a good reason why the node exporter chooses to do (similar) but custom parsing of
/proc/meminfo
to account for the optional unit field, rather than use this library for meminfo as it's used in other collectors.Using the humanize lib that's used elsewhere in other prometheus projects, I have what I believe to be a functional commit here that I'd be happy to contribute if this is determined to be a bug/should be fixed.
Example output with the patched lib: