Conversation
ec73c90 to
dc49974
Compare
PIDs can vanish (exit) from /proc/ between gathering the list of PIDs and getting all of their stats. * Ignore file not found errors. * Explicitly count the PIDs we find. * Cleanup some error style issues. Signed-off-by: Ben Kochie <superq@gmail.com>
dc49974 to
0c42334
Compare
Contributor
|
👍 |
juliusv
reviewed
Aug 13, 2018
| stat, err := pid.NewStat() | ||
| // PIDs can vanish between getting the list and getting stats. | ||
| if os.IsNotExist(err) { | ||
| log.Debugf("file not found when retrieving stats: %q", err) |
Member
There was a problem hiding this comment.
Just use %s or %v for error type formatting (but %q is good to quote file names embedded in a string).
Member
Author
There was a problem hiding this comment.
This is an issue all over the codebase. I filed #1044 to do cleanup.
Member
There was a problem hiding this comment.
It seems like all the other %q I found are legit - %q makes sense when you actually want to quote something, but when you have a final colon and then an entire error string following, it doesn't make sense to quote that.
oblitorum
pushed a commit
to shatteredsilicon/node_exporter
that referenced
this pull request
Apr 9, 2024
PIDs can vanish (exit) from /proc/ between gathering the list of PIDs and getting all of their stats. * Ignore file not found errors. * Explicitly count the PIDs we find. * Cleanup some error style issues. 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.
PIDs can vanish (exit) from /proc/ between gathering the list of PIDs
and getting all of their stats.
Fixes: #1042
Signed-off-by: Ben Kochie superq@gmail.com