Remove error wrapper from /sys/class/power_supply#308
Merged
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>
Member
Author
|
This is similar to #302. |
SuperQ
added a commit
to prometheus/node_exporter
that referenced
this pull request
Jun 13, 2020
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>
Member
|
The node exporter is go1.14. can't we use errors.Is ? |
Member
Author
|
Oh, I didn't know about that one. Yes, we already require Go 1.14 for https, so that should be fine. |
Member
Author
|
I tried that out on a test build, it doesn't seem to work. |
Member
|
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+ |
Member
Author
|
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. |
SuperQ
added a commit
to prometheus/node_exporter
that referenced
this pull request
Jun 15, 2020
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>
remijouannet
pushed a commit
to remijouannet/procfs
that referenced
this pull request
Oct 20, 2022
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>
oblitorum
pushed a commit
to shatteredsilicon/node_exporter
that referenced
this pull request
Apr 9, 2024
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>
oblitorum
pushed a commit
to shatteredsilicon/node_exporter
that referenced
this pull request
Apr 9, 2024
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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