-
Notifications
You must be signed in to change notification settings - Fork 808
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
Avoid expensive log.Valuer evaluation for disallowed level #5297
Conversation
a77c82f
to
95975ad
Compare
19b2fbc
to
f6cfaea
Compare
@@ -72,24 +69,32 @@ type PrometheusLogger struct { | |||
// NewPrometheusLogger creates a new instance of PrometheusLogger which exposes | |||
// Prometheus counters for various log levels. | |||
func NewPrometheusLogger(l logging.Level, format logging.Format) (log.Logger, error) { |
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.
This is not being used anymore?
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.
This is used by other packages.
Can you explain what is the functional change here? are we missing/changing something? |
@alanprot I agree, the change is simple but not easy to understand, the old code is like this:
the new code is like this:
the order matters since the logger2.Log does level filtering first then call the logger1.Log on demand, the logger1.Log evaluates the log.Valuer such as log.Caller.. I have add the reference link in the comments: go-kit/log#14 (comment) |
Signed-off-by: Xiaochao Dong (@damnever) <[email protected]>
NIce! Ok.. |
Signed-off-by: Xiaochao Dong <[email protected]>
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.
This is an awesome enhancement, thank you so much!
A lot of failed operations in memcach_client.SetAsync will consume a lot of CPU:
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]