diff --git a/health/grpc_health_v1alpha/health.pb.go b/health/grpc_health_v1alpha/health.pb.go index 14356f27..6bfbe497 100644 --- a/health/grpc_health_v1alpha/health.pb.go +++ b/health/grpc_health_v1alpha/health.pb.go @@ -21,10 +21,6 @@ import ( grpc "google.golang.org/grpc" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -52,7 +48,6 @@ func (x HealthCheckResponse_ServingStatus) String() string { } type HealthCheckRequest struct { - Host string `protobuf:"bytes,1,opt,name=host" json:"host,omitempty"` Service string `protobuf:"bytes,2,opt,name=service" json:"service,omitempty"` } @@ -72,6 +67,10 @@ func init() { proto.RegisterEnum("grpc.health.v1alpha.HealthCheckResponse_ServingStatus", HealthCheckResponse_ServingStatus_name, HealthCheckResponse_ServingStatus_value) } +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + // Client API for HealthCheck service type HealthCheckClient interface { diff --git a/health/grpc_health_v1alpha/health.proto b/health/grpc_health_v1alpha/health.proto index 747a4f03..1ca5bbc1 100644 --- a/health/grpc_health_v1alpha/health.proto +++ b/health/grpc_health_v1alpha/health.proto @@ -3,7 +3,6 @@ syntax = "proto3"; package grpc.health.v1alpha; message HealthCheckRequest { - string host = 1; string service = 2; } diff --git a/health/health.go b/health/health.go index e7b63853..3a836f2a 100644 --- a/health/health.go +++ b/health/health.go @@ -24,7 +24,7 @@ func NewHealthServer() *HealthServer { } func (s *HealthServer) Check(ctx context.Context, in *healthpb.HealthCheckRequest) (*healthpb.HealthCheckResponse, error) { - service := in.Host + ":" + in.Service + service := in.Service s.mu.Lock() defer s.mu.Unlock() if status, ok := s.statusMap[service]; ok { @@ -37,8 +37,7 @@ func (s *HealthServer) Check(ctx context.Context, in *healthpb.HealthCheckReques // SetServingStatus is called when need to reset the serving status of a service // or insert a new service entry into the statusMap. -func (s *HealthServer) SetServingStatus(host string, service string, status healthpb.HealthCheckResponse_ServingStatus) { - service = host + ":" + service +func (s *HealthServer) SetServingStatus(service string, status healthpb.HealthCheckResponse_ServingStatus) { s.mu.Lock() s.statusMap[service] = status s.mu.Unlock() diff --git a/test/end2end_test.go b/test/end2end_test.go index 761f25a1..1c9cc460 100644 --- a/test/end2end_test.go +++ b/test/end2end_test.go @@ -392,7 +392,6 @@ func healthCheck(t time.Duration, cc *grpc.ClientConn, serviceName string) (*hea ctx, _ := context.WithTimeout(context.Background(), t) hc := healthpb.NewHealthCheckClient(cc) req := &healthpb.HealthCheckRequest{ - Host: "", Service: serviceName, } return hc.Check(ctx, req) @@ -406,7 +405,7 @@ func TestHealthCheckOnSuccess(t *testing.T) { func testHealthCheckOnSuccess(t *testing.T, e env) { hs := health.NewHealthServer() - hs.SetServingStatus("", "grpc.health.v1alpha.HealthCheck", 1) + hs.SetServingStatus("grpc.health.v1alpha.HealthCheck", 1) s, cc := setUp(hs, math.MaxUint32, "", e) defer tearDown(s, cc) if _, err := healthCheck(1*time.Second, cc, "grpc.health.v1alpha.HealthCheck"); err != nil { @@ -422,7 +421,7 @@ func TestHealthCheckOnFailure(t *testing.T) { func testHealthCheckOnFailure(t *testing.T, e env) { hs := health.NewHealthServer() - hs.SetServingStatus("", "grpc.health.v1alpha.HealthCheck", 1) + hs.SetServingStatus("grpc.health.v1alpha.HealthCheck", 1) s, cc := setUp(hs, math.MaxUint32, "", e) defer tearDown(s, cc) if _, err := healthCheck(0*time.Second, cc, "grpc.health.v1alpha.HealthCheck"); err != grpc.Errorf(codes.DeadlineExceeded, "context deadline exceeded") { @@ -457,7 +456,7 @@ func testHealthCheckServingStatus(t *testing.T, e env) { if _, err := healthCheck(1*time.Second, cc, "grpc.health.v1alpha.HealthCheck"); err != grpc.Errorf(codes.NotFound, "unknown service") { t.Fatalf("HealthCheck/Check(_, _) = _, %v, want _, error code %d", err, codes.NotFound) } - hs.SetServingStatus("", "grpc.health.v1alpha.HealthCheck", healthpb.HealthCheckResponse_SERVING) + hs.SetServingStatus("grpc.health.v1alpha.HealthCheck", healthpb.HealthCheckResponse_SERVING) out, err := healthCheck(1*time.Second, cc, "grpc.health.v1alpha.HealthCheck") if err != nil { t.Fatalf("HealthCheck/Check(_, _) = _, %v, want _, ", err) @@ -465,7 +464,7 @@ func testHealthCheckServingStatus(t *testing.T, e env) { if out.Status != healthpb.HealthCheckResponse_SERVING { t.Fatalf("Got the serving status %v, want SERVING", out.Status) } - hs.SetServingStatus("", "grpc.health.v1alpha.HealthCheck", healthpb.HealthCheckResponse_NOT_SERVING) + hs.SetServingStatus("grpc.health.v1alpha.HealthCheck", healthpb.HealthCheckResponse_NOT_SERVING) out, err = healthCheck(1*time.Second, cc, "grpc.health.v1alpha.HealthCheck") if err != nil { t.Fatalf("HealthCheck/Check(_, _) = _, %v, want _, ", err)