prometheus / procfs

procfs provides functions to retrieve system, kernel and process metrics from the pseudo-filesystem proc.
Apache License 2.0
754 stars 311 forks source link

infiniband: do not fail if board_id is not present #556

Closed dswarbrick closed 9 months ago

dswarbrick commented 11 months ago

Whilst a large majority do, not all InfiniBand drivers expose a board_id in sysfs.

Fixes: https://github.com/prometheus/node_exporter/issues/2769

SuperQ commented 11 months ago

I wonder if we should make the values in the struct *string and set it to nil if the file is not found.

dswarbrick commented 11 months ago

I wonder if we should make the values in the struct *string and set it to nil if the file is not found.

Doing so means that consumers of this need to check for non-nil before using the struct members. I'm not sure if that's a good thing or not. Given that Prometheus does not store empty-string labels, my gut feeling is that it's more convenient to simply leave these struct members as empty strings if not found, meaning that node_exporter can just blindly assign them to labels.

mustafakemalgilor commented 10 months ago

Related-to: https://github.com/prometheus/node_exporter/issues/2769