Log GRPC server errors#2541
Merged
anshulpundir merged 1 commit intomoby:masterfrom Mar 8, 2018
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2541 +/- ##
==========================================
- Coverage 66.79% 61.37% -5.42%
==========================================
Files 84 133 +49
Lines 11938 21746 +9808
==========================================
+ Hits 7974 13347 +5373
- Misses 3149 6962 +3813
- Partials 815 1437 +622 |
cyli
approved these changes
Mar 8, 2018
Contributor
cyli
left a comment
There was a problem hiding this comment.
Other than a logging field nitpick, LGTM
| // pass the call down into the grpc_prometheus interceptor | ||
| err := grpc_prometheus.StreamServerInterceptor(srv, ss, info, handler) | ||
| if err != nil { | ||
| log.G(ss.Context()).WithField("method", info.FullMethod).WithError(err).Debug("error handling streaming rpc") |
Contributor
There was a problem hiding this comment.
Nitpick - the unary interceptor uses the field rpc, whereas this uses the field method - we already use method in a lot of our other logging, so would it make sense for this field to be rpc as well?
Collaborator
Author
There was a problem hiding this comment.
oh, idk what i did here... good catch.
anshulpundir
approved these changes
Mar 8, 2018
Changes the grpc unary and stream interceptors to implement logging of errors returned by RPCs (while also letting the prometheus interceptors do their thing). The biggest motivation for this change is that if a client times out while a grpc method is happening, the client may not ever get an error from the server, but the server should hopefully log an error explaining why it couldn't handle the request (like what part it may have been blocked on). Signed-off-by: Drew Erny <drew.erny@docker.com>
anshulpundir
approved these changes
Mar 8, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes the grpc unary and stream interceptors to implement logging of errors returned by RPCs (while also letting the prometheus interceptors do their thing).
The biggest motivation for this change is that if a client times out while a GRPC method is happening, the client may not ever get an error from the server, but the server should hopefully log an error explaining why it couldn't handle the request (like what part it may have been blocked on).