diff --git a/pkg/output/xatu/exporter.go b/pkg/output/xatu/exporter.go index c5469ac3..99b22d53 100644 --- a/pkg/output/xatu/exporter.go +++ b/pkg/output/xatu/exporter.go @@ -31,10 +31,8 @@ type ItemExporter struct { func NewItemExporter(name string, config *Config, log logrus.FieldLogger) (ItemExporter, error) { opts := []grpc.DialOption{ - grpc.WithUnaryInterceptor(grpc_prometheus.UnaryClientInterceptor), - grpc.WithStreamInterceptor(grpc_prometheus.StreamClientInterceptor), - grpc.WithStreamInterceptor(retry.StreamClientInterceptor()), - grpc.WithUnaryInterceptor(retry.UnaryClientInterceptor()), + grpc.WithChainUnaryInterceptor(grpc_prometheus.UnaryClientInterceptor, retry.UnaryClientInterceptor()), + grpc.WithChainStreamInterceptor(grpc_prometheus.StreamClientInterceptor, retry.StreamClientInterceptor()), } if config.TLS { diff --git a/pkg/server/server.go b/pkg/server/server.go index d46bbe3b..94ccec5b 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -227,8 +227,6 @@ func (x *Xatu) startGrpcServer(ctx context.Context) error { grpc_prometheus.EnableHandlingTimeHistogram() opts := []grpc.ServerOption{ - grpc.StreamInterceptor(grpc_prometheus.StreamServerInterceptor), - grpc.UnaryInterceptor(grpc_prometheus.UnaryServerInterceptor), grpc.MaxRecvMsgSize(mb100), grpc.KeepaliveParams(keepalive.ServerParameters{ MaxConnectionIdle: 5 * time.Minute, @@ -237,7 +235,11 @@ func (x *Xatu) startGrpcServer(ctx context.Context) error { Time: 1 * time.Minute, Timeout: 15 * time.Second, }), + grpc.ChainStreamInterceptor( + grpc.StreamServerInterceptor(grpc_prometheus.StreamServerInterceptor), + ), grpc.ChainUnaryInterceptor( + grpc.UnaryServerInterceptor(grpc_prometheus.UnaryServerInterceptor), func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { resp, err := handler(ctx, req) if err != nil {