feat(transport/grpc): grpc client supports health check option #3067
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.
Description (what this PR does / why we need it):
Refer to #2736 (comment) grpc client healthCheck is force to enable.
But in https://github.com/grpc/grpc/blob/master/doc/health-checking.md#grpc-health-checking-protocol, the
Watch()
returns a stream resp:In some special business usecase,I must use nginx or any other gateway to proxy the grpc request. But it is not support stream resp and it will always return write_timeout. It will take some error in my case like:
rpc error: code = Unavailable desc = last connection error: connection active but received health check RPC error: rpc error: code = Internal desc = stream terminated by RST_STREAM with error code: INTERNAL_ERROR"
The nginx plus has impl the health check with https://docs.nginx.com/nginx/admin-guide/load-balancer/grpc-health-check/.
I think it should support an option for user to choice if I want to use the client's health check. And with the #2736 (comment) user should notice it may affects the forward compatibility.
In this pr, it adds a function
WithHealthCheck()
to disable health check(default is true).Which issue(s) this PR fixes (resolves / be part of):
Other special notes for the reviewers: