Skip to content

Log GRPC server errors#2541

Merged
anshulpundir merged 1 commit intomoby:masterfrom
dperny:log-grpc-errors
Mar 8, 2018
Merged

Log GRPC server errors#2541
anshulpundir merged 1 commit intomoby:masterfrom
dperny:log-grpc-errors

Conversation

@dperny
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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

Comment thread manager/manager.go Outdated
// 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
Copy Markdown
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
Copy Markdown
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 <drew.erny@docker.com>
@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