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
[Merged by Bors] - Use ctxzap in GRPC services #4816
Conversation
- log start of GRPC call with middleware - use context-aware logging in GRPC services with ctxzap - give time to send response on AdminService/Recover before shutting down - shutdown with os.Exit instead of panic on /Recover
Codecov Report
@@ Coverage Diff @@
## develop #4816 +/- ##
=========================================
- Coverage 76.9% 76.8% -0.1%
=========================================
Files 261 261
Lines 30259 30215 -44
=========================================
- Hits 23274 23212 -62
- Misses 5485 5501 +16
- Partials 1500 1502 +2
|
@fasmat is there anything else you require changes for? Regarding |
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.
For now it's probably OK. There is already an issue in the backlog regarding removing the global logger: #4751
Maybe we can update that issue to completely remove the log
package?
bors merge |
## Motivation The start of GRPC calls was manually logged. It can be automated and enriched with contextual information about the GRPC connection using middleware. We already use Zap's [UnaryServerInterceptor](https://pkg.go.dev/github.com/grpc-ecosystem/go-grpc-middleware@v1.4.0/logging/zap#UnaryServerInterceptor) that appends a logger into the `Context` of a GRPC call. It can be later extracted with [ctxzap](https://pkg.go.dev/github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap). ## Changes - log start of GRPC call with middleware - use context-aware logging in GRPC services with ctxzap - give time to send a response on AdminService/Recover before shutting down - shutdown with os.Exit instead of panic on /Recover ## Test Plan - existing tests pass - added test for AdminService/Recover
Build failed: |
bors merge |
## Motivation The start of GRPC calls was manually logged. It can be automated and enriched with contextual information about the GRPC connection using middleware. We already use Zap's [UnaryServerInterceptor](https://pkg.go.dev/github.com/grpc-ecosystem/go-grpc-middleware@v1.4.0/logging/zap#UnaryServerInterceptor) that appends a logger into the `Context` of a GRPC call. It can be later extracted with [ctxzap](https://pkg.go.dev/github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap). ## Changes - log start of GRPC call with middleware - use context-aware logging in GRPC services with ctxzap - give time to send a response on AdminService/Recover before shutting down - shutdown with os.Exit instead of panic on /Recover ## Test Plan - existing tests pass - added test for AdminService/Recover
Build failed: |
bors try |
@countvonzero could you please check my changes around recovery? I changed it to quit asynchronously after 1 second to give time to send a GRPC response. Do you see any potential problems with it? |
tryBuild failed: |
bors try |
tryBuild failed: |
thanks for double-checking. there is no problem with Recover() RPC. it's also only used for systest. |
dd39156
to
c7100ec
Compare
15a89e2
to
ce3c3dd
Compare
Bors merge |
## Motivation The start of GRPC calls was manually logged. It can be automated and enriched with contextual information about the GRPC connection using middleware. We already use Zap's [UnaryServerInterceptor](https://pkg.go.dev/github.com/grpc-ecosystem/go-grpc-middleware@v1.4.0/logging/zap#UnaryServerInterceptor) that appends a logger into the `Context` of a GRPC call. It can be later extracted with [ctxzap](https://pkg.go.dev/github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap). ## Changes - log start of GRPC call with middleware - use context-aware logging in GRPC services with ctxzap - give time to send a response on AdminService/Recover before shutting down - shutdown with os.Exit instead of panic on /Recover ## Test Plan - existing tests pass - added test for AdminService/Recover
Pull request successfully merged into develop. Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
Motivation
The start of GRPC calls was manually logged. It can be automated and enriched with contextual information about the GRPC connection using middleware. We already use Zap's UnaryServerInterceptor that appends a logger into the
Context
of a GRPC call. It can be later extracted with ctxzap.Changes
Test Plan