mirror of https://github.com/grpc/grpc-go.git
xds: add reflection and health service to example server (#3403)
This commit is contained in:
parent
f8ad812d8e
commit
224056d331
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue