-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove error wrapper from /sys/class/power_supply #308
Conversation
Don't wrap the error of `ioutil.ReadDir()` so that the error return can be tested with `os.IsNotExist()`. Fixes node_exporter log noise. ``` caller=collector.go:161 msg="collector failed" name=powersupplyclass duration_seconds=0.00079848 err="could not get power_supply class info: error obtaining power_supply class info: failed to list power supplies at \"/sys/class/power_supply\": open /sys/class/power_supply: no such file or directory" ``` Signed-off-by: Ben Kochie <superq@gmail.com>
This is similar to #302. |
Handle the case when /sys/class/power_supply doesn't exist. Fixes logging error spam. Requires prometheus/procfs#308 Signed-off-by: Ben Kochie <superq@gmail.com>
The node exporter is go1.14. can't we use errors.Is ? |
Oh, I didn't know about that one. Yes, we already require Go 1.14 for https, so that should be fine. |
I tried that out on a test build, it doesn't seem to work. |
Indeed. It requires the fmt.Errorf to use %w instead of %v for the error. Do you think this is worth it? Would make procfs 1.13+ |
Hrm, maybe good to start using it upstream, but for now let's un-wrap the error. We want to keep procfs compatible with what client_golang needs for Go versions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Handle the case when /sys/class/power_supply doesn't exist. Fixes logging error spam. Requires prometheus/procfs#308 Signed-off-by: Ben Kochie <superq@gmail.com>
Don't wrap the error of `ioutil.ReadDir()` so that the error return can be tested with `os.IsNotExist()`. Fixes node_exporter log noise. ``` caller=collector.go:161 msg="collector failed" name=powersupplyclass duration_seconds=0.00079848 err="could not get power_supply class info: error obtaining power_supply class info: failed to list power supplies at \"/sys/class/power_supply\": open /sys/class/power_supply: no such file or directory" ``` Signed-off-by: Ben Kochie <superq@gmail.com>
Handle the case when /sys/class/power_supply doesn't exist. Fixes logging error spam. Requires prometheus/procfs#308 Signed-off-by: Ben Kochie <superq@gmail.com>
Handle the case when /sys/class/power_supply doesn't exist. Fixes logging error spam. Requires prometheus/procfs#308 Signed-off-by: Ben Kochie <superq@gmail.com>
Don't wrap the error of
ioutil.ReadDir()
so that the error return canbe tested with
os.IsNotExist()
. Fixes node_exporter log noise.Signed-off-by: Ben Kochie superq@gmail.com