-
Notifications
You must be signed in to change notification settings - Fork 136
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
chore!: adopt log/slog, drop go-kit/log #183
Conversation
This PR includes: - linter updates to enable `sloglint` linter - Go dep updates for prometheus/{client_golang,common,exporter-toolkit} libs - refactorings to adopt log/slog in favor of go-kit/log The bulk of this PR was automated by the following script which is being used to aid in converting the various exporters/projects to use slog: https://gist.github.com/tjhop/49f96fb7ebbe55b12deee0b0312d8434 Signed-off-by: SuperQ <[email protected]>
👓 @tjhop |
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.
Overall mostly ok, just a few nits here and there. Some of the logging calls that pass an error as a KV should perhaps actually be logger.Error(...)
instead of Warn
or Info
. I think some of the Info
logging calls are also actually more like Debug
.
I'm not sure how necessary it is to log an error immediately before returning a wrapped error, e.g.
c.logger.Error("Error polling:", "err", err)
return fmt.Errorf("error polling: %w", err)
In cases like that, it probably makes more sense that the caller chooses whether to log the returned error.
Lastly, there seems to be some inconsistency between logging errors with the key err
and error
. It would be good to standardize on one or the other.
Decisions about what to log when, as well as changing a lot of the logging strings, is scope creep. Additional improvements in logging are something that will be done in separate PRs. |
Signed-off-by: Ben Kochie <[email protected]> Co-authored-by: Daniel Swarbrick <[email protected]> Signed-off-by: Ben Kochie <[email protected]>
This PR includes:
sloglint
linterThe bulk of this PR was automated by the following script which is being used to aid in converting the various exporters/projects to use slog:
https://gist.github.com/tjhop/49f96fb7ebbe55b12deee0b0312d8434