Skip to content
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

Log GRPC server errors #2541

Merged
merged 1 commit into from
Mar 8, 2018
Merged

Log GRPC server errors #2541

merged 1 commit into from
Mar 8, 2018

Conversation

dperny
Copy link
Collaborator

@dperny dperny commented Mar 6, 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).

@codecov
Copy link

codecov bot commented Mar 6, 2018

Codecov Report

Merging #2541 into master will decrease coverage by 5.41%.
The diff coverage is 100%.

@@            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

@dperny dperny force-pushed the log-grpc-errors branch from 4cb5974 to 560bcaf Compare March 6, 2018 23:56
Copy link
Contributor

@cyli cyli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, idk what i did here... good catch.

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 <[email protected]>
@dperny dperny force-pushed the log-grpc-errors branch from 560bcaf to cb3b9a7 Compare March 8, 2018 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants