You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
connectrpc.com/grpchealth adds support for gRPC-style health checks to any
net/http server — including those built with Connect. By
polling this API, load balancers, container orchestrators, and other
infrastructure systems can respond to changes in your HTTP server's health.
package main
import (
"net/http""golang.org/x/net/http2""golang.org/x/net/http2/h2c""connectrpc.com/grpchealth"
)
funcmain() {
mux:=http.NewServeMux()
checker:=grpchealth.NewStaticChecker(
"acme.user.v1.UserService",
"acme.group.v1.GroupService",
// protoc-gen-connect-go generates package-level constants// for these fully-qualified protobuf service names, so you'd more likely// reference userv1.UserServiceName and groupv1.GroupServiceName.
)
mux.Handle(grpchealth.NewHandler(checker))
// If you don't need to support HTTP/2 without TLS (h2c), you can drop// x/net/http2 and use http.ListenAndServeTLS instead.http.ListenAndServe(
":8080",
h2c.NewHandler(mux, &http2.Server{}),
)
}
Status: Stable
This module is stable. It supports:
The two most recent major releases of Go (the same version of Go that continue to
eceive security patches).
APIv2 of Protocol Buffers in Go (google.golang.org/protobuf).
Within those parameters, grpchealth follows semantic versioning.
We will not make breaking changes in the 1.x series of releases.