mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver/api/v3rpc: add default grpc health service
This commit is contained in:
parent
71e6fe183f
commit
c1e3172e3a
@ -19,9 +19,12 @@ import (
|
||||
|
||||
"github.com/coreos/etcd/etcdserver"
|
||||
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/health"
|
||||
healthpb "google.golang.org/grpc/health/grpc_health_v1"
|
||||
)
|
||||
|
||||
const grpcOverheadBytes = 512 * 1024
|
||||
@ -48,5 +51,12 @@ func Server(s *etcdserver.EtcdServer, tls *tls.Config) *grpc.Server {
|
||||
pb.RegisterAuthServer(grpcServer, NewAuthServer(s))
|
||||
pb.RegisterMaintenanceServer(grpcServer, NewMaintenanceServer(s))
|
||||
|
||||
// server should register all the services manually
|
||||
// use empty service name for all etcd services' health status,
|
||||
// see https://github.com/grpc/grpc/blob/master/doc/health-checking.md for more
|
||||
hsrv := health.NewServer()
|
||||
hsrv.SetServingStatus("", healthpb.HealthCheckResponse_SERVING)
|
||||
healthpb.RegisterHealthServer(grpcServer, hsrv)
|
||||
|
||||
return grpcServer
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user