From 3103a1925588e93c7f87985e74f0553ec3641499 Mon Sep 17 00:00:00 2001 From: Jordan Rushing Date: Mon, 27 Sep 2021 11:23:22 -0500 Subject: [PATCH] Re-add gRPC recovery middleware --- pkg/loki/loki.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/loki/loki.go b/pkg/loki/loki.go index 1f59e11d2d28..6b3e9eae7c5c 100644 --- a/pkg/loki/loki.go +++ b/pkg/loki/loki.go @@ -29,6 +29,7 @@ import ( "github.com/weaveworks/common/middleware" "github.com/weaveworks/common/server" "github.com/weaveworks/common/signals" + "google.golang.org/grpc" "google.golang.org/grpc/health/grpc_health_v1" "github.com/grafana/loki/pkg/distributor" @@ -43,6 +44,7 @@ import ( "github.com/grafana/loki/pkg/storage/chunk" "github.com/grafana/loki/pkg/storage/stores/shipper/compactor" "github.com/grafana/loki/pkg/tracing" + serverutil "github.com/grafana/loki/pkg/util/server" "github.com/grafana/loki/pkg/validation" ) @@ -220,6 +222,8 @@ func New(cfg Config) (*Loki, error) { } func (t *Loki) setupAuthMiddleware() { + t.Cfg.Server.GRPCMiddleware = []grpc.UnaryServerInterceptor{serverutil.RecoveryGRPCUnaryInterceptor} + t.Cfg.Server.GRPCStreamMiddleware = []grpc.StreamServerInterceptor{serverutil.RecoveryGRPCStreamInterceptor} // Don't check auth header on TransferChunks, as we weren't originally // sending it and this could cause transfers to fail on update. t.HTTPAuthMiddleware = fakeauth.SetupAuthMiddleware(&t.Cfg.Server, t.Cfg.AuthEnabled,