-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Grpc healthcheck docs are unclear #1977
Comments
Hi @Pryanishnik, thanks for your issue. The docs are talking about implementing the gRPC health check protocol, which may not be what you want. If you want to simply add a gwmux := runtime.NewServeMux()
err := gw.RegisterYourServiceHandlerFromEndpoint(ctx, gwmux, *grpcServerEndpoint, opts)
if err != nil {
log.Fatalln("failed to register gateway:", err)
}
mux := http.NewServeMux()
mux.Handle("/", gwmux)
mux.Handle("/health", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})
http.ListenAndServe(":3000", mux) Does that make sense? |
Thank you for reply @johanbrandhorst. Not exactly. I want to use gRPC healthcheck protocol. ACtually, how I do it now using In this case, architecture becomes pretty complicated. I want to remove this health proxy and am wondering if I can get health proxy functionality in gRPC gateway "from the box"? So, if grpc gateway can reroute outer REST to default grpc health check? |
The grpc-gateway doesn't have any built in functionality to translate this. You could take the existing grpc health check protofile and generate some REST annotations for it using the |
Yes, it clarifies a bit, thank you! But for future it makes sense to implement this translation. I.E. AWS Load Balancer will not work with server for autosacling, coz it needs healthchecks. If we use REST we can not do default grpc healthchecks, and in this case we have to implement own workaround for REST healthchecks. But anyway, thank you! |
If you'd like to contribute something to the docs I'd be very grateful. I agree that the health checks section is pretty poor. I've never implemented it myself though so I don't know what to put. |
https://grpc-ecosystem.github.io/grpc-gateway/docs/operations/health_check/
From this doc I can not understand where I have to put imports and register service.
Also, I don't understand if I have to make separate healthcheck service.
Why we can not use DefaultHealthCheck?
It probab;y make sense to make "transparent" call of default healthcheck from outer REST. I.E. Amazon Load Balancer uses it for determining instance state.
Or if we can, please clarify how to enable it
The text was updated successfully, but these errors were encountered: