Skip to content

Commit

Permalink
Vendor in health protobuf stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
csmarchbanks committed Mar 12, 2018
1 parent 003d6b9 commit db98e77
Show file tree
Hide file tree
Showing 6 changed files with 234 additions and 19 deletions.
3 changes: 2 additions & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
ingester_client "github.com/weaveworks/cortex/pkg/ingester/client"
"github.com/weaveworks/cortex/pkg/ring"
"github.com/weaveworks/cortex/pkg/util"
"google.golang.org/grpc/health/grpc_health_v1"
)

var errIngestionRateLimitExceeded = errors.New("ingestion rate limit exceeded")
Expand Down Expand Up @@ -222,8 +223,8 @@ func (d *Distributor) healthCheckAndRemoveIngester(addr string, client client.In
ctx, cancel := context.WithTimeout(context.Background(), d.cfg.RemoteTimeout)
defer cancel()
ctx = user.InjectOrgID(ctx, "0")
resp, err := client.Check(ctx, &ingester_client.HealthCheckRequest{})
if err != nil || resp.Status != ingester_client.SERVING {
resp, err := client.Check(ctx, &grpc_health_v1.HealthCheckRequest{})
if err != nil || resp.Status != grpc_health_v1.HealthCheckResponse_SERVING {
level.Warn(util.Logger).Log("msg", "removing ingester client failing healthcheck", "addr", addr, "reason", err)

d.clientsMtx.Lock()
Expand Down
16 changes: 2 additions & 14 deletions pkg/ingester/client/cortex.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package cortex;
option go_package = "client";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google.golang.org/grpc/health/grpc_health_v1/health.proto";

option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
Expand All @@ -18,7 +19,7 @@ service Ingester {

// TransferChunks allows leaving ingester (client) to stream chunks directly to joining ingesters (server).
rpc TransferChunks(stream TimeSeriesChunk) returns (TransferChunksResponse) {};
rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
rpc Check(grpc.health.v1.HealthCheckRequest) returns (grpc.health.v1.HealthCheckResponse);
}

message WriteRequest {
Expand Down Expand Up @@ -123,16 +124,3 @@ message LabelMatcher {
string name = 2;
string value = 3;
}

message HealthCheckRequest {
string service = 1;
}

message HealthCheckResponse {
enum ServingStatus {
UNKNOWN = 0;
SERVING = 1;
NOT_SERVING = 2;
}
ServingStatus status = 1;
}
5 changes: 3 additions & 2 deletions pkg/ingester/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

// Needed for gRPC compatibility.
old_ctx "golang.org/x/net/context"
"google.golang.org/grpc/health/grpc_health_v1"

"github.com/go-kit/kit/log/level"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -473,8 +474,8 @@ func (i *Ingester) UserStats(ctx old_ctx.Context, req *client.UserStatsRequest)
}

// Check implements the grpc healthcheck
func (i *Ingester) Check(ctx old_ctx.Context, req *client.HealthCheckRequest) (*client.HealthCheckResponse, error) {
return &client.HealthCheckResponse{Status: client.SERVING}, nil
func (i *Ingester) Check(ctx old_ctx.Context, req *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error) {
return &grpc_health_v1.HealthCheckResponse{Status: grpc_health_v1.HealthCheckResponse_SERVING}, nil
}

// Describe implements prometheus.Collector.
Expand Down
190 changes: 190 additions & 0 deletions vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions vendor/google.golang.org/grpc/health/grpc_health_v1/health.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit db98e77

Please sign in to comment.