-
Notifications
You must be signed in to change notification settings - Fork 692
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
Fix grpc middleware interceptor not PostCall-ing when a streaming RPC with non-streaming server finishes successfully. #725
Conversation
… with non-streaming server finishes.
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.
Nice! Could you add a test for this?
Hi there Johan, Sure - I'll take a stab next week, pretty loaded right now with other things. |
@johanbrandhorst OK i finally had some time to take another pass at this. I added a test and a relevant API to the testpb proto. I had to update grpc-go though - is it OK or should I make an effort to make sure I re-gen the testpb grpc using the same versions you have in repo? |
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.
Looks like there are still some lint failures, can you try running make lint
?
I ran make lint and cleared out all linting issues, but the github check is failing:
Not exactly sure what to make of it. Do I need to modify something else? |
I think the README thing is a bug, I'm not sure why it happens but I won't let it block this merge |
Thank you for your contribution! |
Current Client-side Stream Interceptor implementation is bugged - it assumes that if the RPC is streaming, then the Server must be streaming responses too. This is incorrect, as a Streaming RPC can be either a Bidi stream ( which are currently handled properly ), or a Client-side only stream. In this case, if the RPC finished successfully, then PostCall never fires as Interceptor assumes it should get an io.EOF ( which obviously does not make sense when Server is not sending a response stream ).
This most obviously manifests when using it with Prometheus reporter - client side metrics for such RPCs that depend on PostCall ( grpc_client_handled_total, grpc_client_handling_seconds ) are not exported.
Changes
Verification
.