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
how to use health check? #13962
Comments
See health_service_end2end_test.cc for an example. If you have enabled it, you should be fine. health_service_end2end_test.cc / VerifyHealthCheckService shows an example verifier code you could try. |
@Falco20019 thanks, I saw this file yesterday, but I am still confused. After |
|
@Falco20019 Clients must write code to call |
This service is meant mostly for load balancers. You can just call a client method even if the client is not there yet or if there are network problems. GRPC will block the call and retry until the client can execute the call or the deadline is defined and reached. For that you don’t have to enable this option at all. |
@YuleiXiao what do you want to achieve? Indeed the service makes more sense for load balancers and (centralized) health checkers. |
@yang-g I thought health check can be used to check if network connection is OK |
@YuleiXiao Assuming you are using C++ API, there are other ways you can monitor the connectivity. You may want to use the C++ channel state API e.g. https://github.com/grpc/grpc/blob/master/include/grpc++/impl/codegen/channel_interface.h#L74 There is also built-in keep-alive style checks that can be tuned with channel arguments here: |
I see the health check document, but I am confused. Is there any example code to show how to enable health check?
I call
EnableDefaultHealthCheckService(true)
before server start, is it open health check? Do I need something else?The text was updated successfully, but these errors were encountered: