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
Instrument error logs #522
Conversation
PR Summary
|
cmd/forwarder/run/run.go
Outdated
return nil, err | ||
} | ||
|
||
return func(name, format string) { |
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.
nit: format
is not used -> _
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.
Don't we have a linter for that? 🤔
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.
It's for the future, probably not worth it.
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
nit: I would squash log/stdlog: add OnError()
with log/stdlog: add name and format to onError
, I don't see a value of keeping them split.
Yeah I should rewrite it. |
This reduces the scope of the fields and avoids data races.
This allows to keep the logger name and avoid mutlielement concatenation on every log.
After adding more fields the Logger has become quite heavy for a copy on every call.
There are multiple options to gather information about error being logged. Adding a listener has a minimal impact on the API and runtime. It does not affect performance of Debug logs in any way.
# HELP forwarder_errors_total Number of errors # TYPE forwarder_errors_total counter forwarder_errors_total{name="A"} 1 forwarder_errors_total{name="B"} 1 Fixes #487
6d38f8b
to
ece1cab
Compare
Sent patchset v2 |
No description provided.