Skip to content

Commit

Permalink
health: split imports into healthpb and healthgrpc (#5466)
Browse files Browse the repository at this point in the history
  • Loading branch information
easwars committed Jun 24, 2022
1 parent c075d20 commit 15739b5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion examples/features/health/server/main.go
Expand Up @@ -30,6 +30,7 @@ import (
"google.golang.org/grpc"
pb "google.golang.org/grpc/examples/features/proto/echo"
"google.golang.org/grpc/health"
healthgrpc "google.golang.org/grpc/health/grpc_health_v1"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
)

Expand Down Expand Up @@ -62,7 +63,7 @@ func main() {

s := grpc.NewServer()
healthcheck := health.NewServer()
healthpb.RegisterHealthServer(s, healthcheck)
healthgrpc.RegisterHealthServer(s, healthcheck)
pb.RegisterEchoServer(s, &echoServer{})

go func() {
Expand Down
3 changes: 2 additions & 1 deletion examples/features/xds/server/main.go
Expand Up @@ -35,6 +35,7 @@ import (
xdscreds "google.golang.org/grpc/credentials/xds"
pb "google.golang.org/grpc/examples/helloworld/helloworld"
"google.golang.org/grpc/health"
healthgrpc "google.golang.org/grpc/health/grpc_health_v1"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/xds"
)
Expand Down Expand Up @@ -95,7 +96,7 @@ func main() {
grpcServer := grpc.NewServer()
healthServer := health.NewServer()
healthServer.SetServingStatus("", healthpb.HealthCheckResponse_SERVING)
healthpb.RegisterHealthServer(grpcServer, healthServer)
healthgrpc.RegisterHealthServer(grpcServer, healthServer)

log.Printf("Serving GreeterService on %s and HealthService on %s", greeterLis.Addr().String(), healthLis.Addr().String())
go func() {
Expand Down
5 changes: 3 additions & 2 deletions interop/xds/server/server.go
Expand Up @@ -37,6 +37,7 @@ import (
"google.golang.org/grpc/xds"

xdscreds "google.golang.org/grpc/credentials/xds"
healthgrpc "google.golang.org/grpc/health/grpc_health_v1"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
Expand Down Expand Up @@ -125,7 +126,7 @@ func main() {
server := grpc.NewServer()
testgrpc.RegisterTestServiceServer(server, testService)
healthServer.SetServingStatus("", healthpb.HealthCheckResponse_SERVING)
healthpb.RegisterHealthServer(server, healthServer)
healthgrpc.RegisterHealthServer(server, healthServer)
testgrpc.RegisterXdsUpdateHealthServiceServer(server, updateHealthService)
reflection.Register(server)
cleanup, err := admin.Register(server)
Expand Down Expand Up @@ -172,7 +173,7 @@ func main() {
// it and start serving.
maintenanceServer := grpc.NewServer()
healthServer.SetServingStatus("", healthpb.HealthCheckResponse_SERVING)
healthpb.RegisterHealthServer(maintenanceServer, healthServer)
healthgrpc.RegisterHealthServer(maintenanceServer, healthServer)
testgrpc.RegisterXdsUpdateHealthServiceServer(maintenanceServer, updateHealthService)
reflection.Register(maintenanceServer)
cleanup, err := admin.Register(maintenanceServer)
Expand Down
6 changes: 3 additions & 3 deletions test/end2end_test.go
Expand Up @@ -470,7 +470,7 @@ type test struct {
// expose the server's health using the default health service
// implementation. This should only be used when a non-default health service
// implementation is required.
healthServer healthpb.HealthServer
healthServer healthgrpc.HealthServer
maxStream uint32
tapHandle tap.ServerInHandle
maxServerMsgSize *int
Expand Down Expand Up @@ -512,12 +512,12 @@ type test struct {
// These are are set once startServer is called. The common case is to have
// only one testServer.
srv stopper
hSrv healthpb.HealthServer
hSrv healthgrpc.HealthServer
srvAddr string

// These are are set once startServers is called.
srvs []stopper
hSrvs []healthpb.HealthServer
hSrvs []healthgrpc.HealthServer
srvAddrs []string

cc *grpc.ClientConn // nil until requested via clientConn
Expand Down
2 changes: 1 addition & 1 deletion test/healthcheck_test.go
Expand Up @@ -86,7 +86,7 @@ func defaultWatchFunc(s *testHealthServer, in *healthpb.HealthCheckRequest, stre
type healthWatchFunc func(s *testHealthServer, in *healthpb.HealthCheckRequest, stream healthgrpc.Health_WatchServer) error

type testHealthServer struct {
healthpb.UnimplementedHealthServer
healthgrpc.UnimplementedHealthServer
watchFunc healthWatchFunc
mu sync.Mutex
status map[string]healthpb.HealthCheckResponse_ServingStatus
Expand Down

0 comments on commit 15739b5

Please sign in to comment.