mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #17922 from marefr/chore_grpc_chain_interceptors
Chore: Use chain interceptors from grpc package
This commit is contained in:
commit
3096df2207
@ -29,7 +29,6 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
||||
grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap"
|
||||
grpc_ctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags"
|
||||
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||
@ -481,12 +480,8 @@ func newGRPCProxyServer(lg *zap.Logger, client *clientv3.Client) *grpc.Server {
|
||||
}
|
||||
|
||||
gopts := []grpc.ServerOption{
|
||||
grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(
|
||||
grpcChainStreamList...,
|
||||
)),
|
||||
grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(
|
||||
grpcChainUnaryList...,
|
||||
)),
|
||||
grpc.ChainStreamInterceptor(grpcChainStreamList...),
|
||||
grpc.ChainUnaryInterceptor(grpcChainUnaryList...),
|
||||
grpc.MaxConcurrentStreams(math.MaxUint32),
|
||||
}
|
||||
if grpcKeepAliveMinTime > time.Duration(0) {
|
||||
|
@ -18,7 +18,6 @@ import (
|
||||
"crypto/tls"
|
||||
"math"
|
||||
|
||||
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
||||
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
||||
"google.golang.org/grpc"
|
||||
@ -61,8 +60,8 @@ func Server(s *etcdserver.EtcdServer, tls *tls.Config, interceptor grpc.UnarySer
|
||||
|
||||
}
|
||||
|
||||
opts = append(opts, grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(chainUnaryInterceptors...)))
|
||||
opts = append(opts, grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(chainStreamInterceptors...)))
|
||||
opts = append(opts, grpc.ChainUnaryInterceptor(chainUnaryInterceptors...))
|
||||
opts = append(opts, grpc.ChainStreamInterceptor(chainStreamInterceptors...))
|
||||
|
||||
opts = append(opts, grpc.MaxRecvMsgSize(int(s.Cfg.MaxRequestBytes+grpcOverheadBytes)))
|
||||
opts = append(opts, grpc.MaxSendMsgSize(maxSendBytes))
|
||||
|
Loading…
x
Reference in New Issue
Block a user