diff --git a/pkg/loki/loki.go b/pkg/loki/loki.go index b68cc5bfa68a8..5f469ac5e3e63 100644 --- a/pkg/loki/loki.go +++ b/pkg/loki/loki.go @@ -17,6 +17,7 @@ import ( "github.com/cortexproject/cortex/pkg/util/fakeauth" "github.com/cortexproject/cortex/pkg/util/flagext" + "github.com/cortexproject/cortex/pkg/util/grpc/healthcheck" "github.com/cortexproject/cortex/pkg/util/modules" "github.com/prometheus/client_golang/prometheus" "github.com/weaveworks/common/signals" @@ -36,6 +37,7 @@ import ( "github.com/weaveworks/common/middleware" "github.com/weaveworks/common/server" "google.golang.org/grpc" + "google.golang.org/grpc/health/grpc_health_v1" "github.com/grafana/loki/pkg/distributor" "github.com/grafana/loki/pkg/ingester" @@ -283,6 +285,8 @@ func (t *Loki) Run() error { // before starting servers, register /ready handler. It should reflect entire Loki. t.Server.HTTP.Path("/ready").Handler(t.readyHandler(sm)) + grpc_health_v1.RegisterHealthServer(t.Server.GRPC, healthcheck.New(sm)) + // This adds a way to see the config and the changes compared to the defaults t.Server.HTTP.Path("/config").HandlerFunc(configHandler(t.Cfg, newDefaultConfig())) diff --git a/pkg/loki/modules.go b/pkg/loki/modules.go index cd81dfcce6e79..c631fcc0e0d15 100644 --- a/pkg/loki/modules.go +++ b/pkg/loki/modules.go @@ -34,7 +34,6 @@ import ( "github.com/weaveworks/common/middleware" "github.com/weaveworks/common/server" "github.com/weaveworks/common/user" - "google.golang.org/grpc/health/grpc_health_v1" "github.com/grafana/loki/pkg/distributor" "github.com/grafana/loki/pkg/ingester" @@ -252,7 +251,6 @@ func (t *Loki) initIngester() (_ services.Service, err error) { logproto.RegisterPusherServer(t.Server.GRPC, t.Ingester) logproto.RegisterQuerierServer(t.Server.GRPC, t.Ingester) logproto.RegisterIngesterServer(t.Server.GRPC, t.Ingester) - grpc_health_v1.RegisterHealthServer(t.Server.GRPC, t.Ingester) t.Server.HTTP.Path("/flush").Handler(http.HandlerFunc(t.Ingester.FlushHandler)) t.Server.HTTP.Methods("POST").Path("/ingester/flush_shutdown").Handler(http.HandlerFunc(t.Ingester.ShutdownHandler)) return t.Ingester, nil