Skip to content

Commit

Permalink
etcdserver/api/v3rpc: add default grpc health service
Browse files Browse the repository at this point in the history
  • Loading branch information
gyuho committed Jun 20, 2017
1 parent 71e6fe1 commit c1e3172
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions etcdserver/api/v3rpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

0 comments on commit c1e3172

Please sign in to comment.