Closed tjhop closed 9 months ago
I had similar thoughts and was considering suggesting a complimentary struct/function for MeminfoBytes
, parseMeminfoBytes()
, fs.MeminfoBytes()
, etc so that the existing code would continue to work as expected.
I think adding in new struct fields for the scaled values to live alongside the raw/unscaled values is a clever solution. I'll work on it 👍
@SuperQ I revamped a bit to try the shadow struct fields, lemme know your thoughts
Amended the last commit to fix an accidental deleted line (thank you tests). Force pushed to fix. Only the last commit was amended, so I believe the approval should still be valid since that commit wasn't touched.
Great, thanks!
Addresses: #565
Previously, this function was ignoring the optional unit field, leading to incorrect results on systems that do report the field. This uses the humanize lib used elsewhere within the Prometheus ecosystem to normalize the value to bytes, including when a unit is provided.