Files
Boris LublinskyandGitHub 3cc6116d9a Add support for tolerations, env, annotations and labels (#1070)
Add support for tolerations, env, annotations and labels
2023-05-31 17:52:25 -07:00

22 lines
700 B
Go

package interceptor
import (
"context"
"google.golang.org/grpc"
klog "k8s.io/klog/v2"
)
// ApiServerInterceptor implements UnaryServerInterceptor that provides the common wrapping logic
// to be executed before and after all API handler calls, e.g. Logging, error handling.
// For more details, see https://github.com/grpc/grpc-go/blob/master/interceptor.go
func ApiServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
klog.Infof("%v handler starting", info.FullMethod)
resp, err = handler(ctx, req)
if err != nil {
klog.Warning(err)
}
klog.Infof("%v handler finished", info.FullMethod)
return
}