From 224056d331568e00f5d10c594653d81d476c2e65 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Thu, 27 Feb 2020 13:17:17 -0800 Subject: [PATCH] xds: add reflection and health service to example server (#3403) --- examples/features/xds/server/main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/features/xds/server/main.go b/examples/features/xds/server/main.go index 52379df1b..512c48397 100644 --- a/examples/features/xds/server/main.go +++ b/examples/features/xds/server/main.go @@ -34,6 +34,9 @@ import ( "google.golang.org/grpc" pb "google.golang.org/grpc/examples/helloworld/helloworld" + "google.golang.org/grpc/health" + healthpb "google.golang.org/grpc/health/grpc_health_v1" + "google.golang.org/grpc/reflection" ) var help = flag.Bool("help", false, "Print usage information") @@ -124,6 +127,12 @@ func main() { } s := grpc.NewServer() pb.RegisterGreeterServer(s, newServer(hostname)) + + reflection.Register(s) + healthServer := health.NewServer() + healthServer.SetServingStatus("", healthpb.HealthCheckResponse_SERVING) + healthpb.RegisterHealthServer(s, healthServer) + log.Printf("serving on %s, hostname %s", lis.Addr(), hostname) s.Serve(lis) }