Add recover middleware for grpc server

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2019-07-30 18:56:48 +05:30
committed by mergify[bot]
parent 2805135e76
commit 8a7022cc50
25 changed files with 9606 additions and 3741 deletions

View File

@ -22,6 +22,7 @@ import (
"sync"
"github.com/container-storage-interface/spec/lib/go/csi"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
"google.golang.org/grpc"
"k8s.io/klog"
)
@ -91,7 +92,10 @@ func (s *nonBlockingGRPCServer) serve(endpoint string, ids csi.IdentityServer, c
}
opts := []grpc.ServerOption{
grpc.UnaryInterceptor(logGRPC),
grpc_middleware.WithUnaryServerChain(
logGRPC,
panicHandler,
),
}
server := grpc.NewServer(opts...)
s.server = server