-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Added Zap as the default Error log #11820 #11830
Added Zap as the default Error log #11820 #11830
Conversation
config/confighttp/confighttp.go
Outdated
// Setting the server error logger | ||
logger := zap.NewStdLog(settings.Logger) | ||
server := &http.Server{ | ||
Handler: handler, | ||
ReadTimeout: hss.ReadTimeout, | ||
ReadHeaderTimeout: hss.ReadHeaderTimeout, | ||
WriteTimeout: hss.WriteTimeout, | ||
IdleTimeout: hss.IdleTimeout, | ||
ErrorLog: logger, |
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.
// Setting the server error logger | |
logger := zap.NewStdLog(settings.Logger) | |
server := &http.Server{ | |
Handler: handler, | |
ReadTimeout: hss.ReadTimeout, | |
ReadHeaderTimeout: hss.ReadHeaderTimeout, | |
WriteTimeout: hss.WriteTimeout, | |
IdleTimeout: hss.IdleTimeout, | |
ErrorLog: logger, | |
server := &http.Server{ | |
Handler: handler, | |
ReadTimeout: hss.ReadTimeout, | |
ReadHeaderTimeout: hss.ReadHeaderTimeout, | |
WriteTimeout: hss.WriteTimeout, | |
IdleTimeout: hss.IdleTimeout, | |
// Setting the server error logger | |
ErrorLog: zap.NewStdLog(settings.Logger), |
Please sign the CLA |
40321b0
to
1e2d843
Compare
1e2d843
to
a9f3aeb
Compare
@bogdandrutu Made the desired Changes snd signed the CLA |
Please add a changelog. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #11830 +/- ##
=======================================
Coverage 91.59% 91.59%
=======================================
Files 449 449
Lines 23761 23763 +2
=======================================
+ Hits 21763 21765 +2
Misses 1623 1623
Partials 375 375 ☔ View full report in Codecov by Sentry. |
a16ea0d
to
6582f98
Compare
@atoulme change log added |
config/confighttp/confighttp.go
Outdated
@@ -479,13 +481,14 @@ func (hss *ServerConfig) ToServer(_ context.Context, host component.Host, settin | |||
next: handler, | |||
includeMetadata: hss.IncludeMetadata, | |||
} | |||
|
|||
errorLog, _ := zap.NewStdLogAt(settings.Logger, zapcore.ErrorLevel) |
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.
can we return the 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.
I dont think so because if errLog is nil in http.Server it will default to standard logger but if we return the error it may disrupt the entire flow In jaeger also similar pattern is followed
https://github.com/jaegertracing/jaeger/blob/8f612a876dc501e0db9786a054ff52fee314afb3/cmd/collector/app/server/http.go#L47
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 fine to return the error, but the error handling won't be tested because the error will never happen - it only happens if the 2nd argument is not a valid log level, e.g. zapcore.Level(123)
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.
sure then will make a change returning the 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.
it only matters if zap changes its internals moving forward, and since we're returning an error anyway, might as well return 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.
Hey Just a small question Unrelated to this
I want to contribute to the OpenTelemetry ecosystem actively. Which repositories would be most suitable for someone at a beginner level to start contributing effectively?
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.
that depends what you like to work on and what you need to get out of the project. Consider joining the CNCF slack and our SIG meetings to get involved.
79f029e
to
bc33333
Compare
@tarun-kavipurapu can you please try to resubmit the PR? |
@dmitryax is this what you mean by resubmitting PR or do you want me to create a new PR |
#### Description This Issue Fixes the Issue #11820 Fixes - Made the Zap as the default ErrorLog Supplied to the Http server --------- Co-authored-by: Alex Boten <[email protected]>
@tarun-kavipurapu I meant creating another PR, but I can try merging this one again |
@dmitryax sure if this one fails i will create a new pr |
@tarun-kavipurapu, it's still failing. Can you please try opening another PR? |
@dmitryax ya will do that and link the pr number here sorry i was a little busy today |
Made a new Pr here #11935 |
Description
This Issue Fixes the Issue #11820
Fixes