Skip to content

Commit

Permalink
initiate grpc health check always (#4181)
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-d authored Aug 18, 2021
1 parent 7ee89ed commit eb5643b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 4 additions & 0 deletions pkg/loki/loki.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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()))

Expand Down
2 changes: 0 additions & 2 deletions pkg/loki/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit eb5643b

Please sign in to comment.