Skip to content

Commit

Permalink
Support gRPC health checking
Browse files Browse the repository at this point in the history
This addresses flyteorg/flyte#489.

For now only server level health checking is supported but we could
extend to service level when needed later.
  • Loading branch information
honnix committed Aug 28, 2020
1 parent 95f5353 commit 1065dbb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/entrypoints/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"github.com/lyft/flytestdlib/logger"
"github.com/spf13/cobra"
"google.golang.org/grpc"
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/reflection"
)

Expand Down Expand Up @@ -54,6 +56,11 @@ func serveInsecure(ctx context.Context, cfg *config.Config) error {
func newGRPCServer(_ context.Context, cfg *config.Config) *grpc.Server {
grpcServer := grpc.NewServer()
datacatalog.RegisterDataCatalogServer(grpcServer, datacatalogservice.NewDataCatalogService())

healthServer := health.NewServer()
healthServer.SetServingStatus("", grpc_health_v1.HealthCheckResponse_SERVING)
grpc_health_v1.RegisterHealthServer(grpcServer, healthServer)

if cfg.GrpcServerReflection {
reflection.Register(grpcServer)
}
Expand Down

0 comments on commit 1065dbb

Please sign in to comment.