Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Chandler <wchandler@gitlab.com>2023-03-30 00:54:34 +0300
committerWill Chandler <wchandler@gitlab.com>2023-03-30 00:54:34 +0300
commitff41d9d77298dbba37b3a3b0278fd573c510c3b6 (patch)
treed784e0b82a283511028af1c97ff1dca9a9e96dbc
parent27ca43c780204547ded4a316ab984caccdb5eb14 (diff)
parent20b0b9c58ec2eb044b2573358799a323aae1e652 (diff)
Merge branch 'renovate/github.com-grpc-ecosystem-go-grpc-middleware-1.x' into 'master'
go: Update module github.com/grpc-ecosystem/go-grpc-middleware to v1.4.0 See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5548 Merged-by: Will Chandler <wchandler@gitlab.com> Approved-by: Christian Couder <chriscool@tuxfamily.org> Co-authored-by: James Fargher <jfargher@gitlab.com> Co-authored-by: GitLab Renovate Bot <gitlab-bot@gitlab.com>
-rw-r--r--client/pool_test.go9
-rw-r--r--go.mod2
-rw-r--r--go.sum4
-rw-r--r--internal/gitaly/server/server.go5
-rw-r--r--internal/log/log_test.go36
-rw-r--r--internal/middleware/commandstatshandler/commandstatshandler_test.go9
-rw-r--r--internal/middleware/featureflag/featureflag_handler_test.go3
-rw-r--r--internal/middleware/limithandler/stats_interceptor_test.go9
-rw-r--r--internal/praefect/grpc-proxy/proxy/testhelper_test.go13
-rw-r--r--internal/praefect/server.go11
-rw-r--r--internal/structerr/grpc_server_test.go3
11 files changed, 46 insertions, 58 deletions
diff --git a/client/pool_test.go b/client/pool_test.go
index 37b6b9920..4ca0696a9 100644
--- a/client/pool_test.go
+++ b/client/pool_test.go
@@ -6,7 +6,6 @@ import (
"sync"
"testing"
- grpcmw "github.com/grpc-ecosystem/go-grpc-middleware"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
gitalyauth "gitlab.com/gitlab-org/gitaly/v15/auth"
@@ -180,16 +179,16 @@ func runServerWithAddr(t *testing.T, creds, addr string) (*health.Server, string
var opts []grpc.ServerOption
if creds != "" {
opts = []grpc.ServerOption{
- grpc.StreamInterceptor(grpcmw.ChainStreamServer(
+ grpc.ChainStreamInterceptor(
auth.StreamServerInterceptor(gitalycfgauth.Config{
Token: creds,
}),
- )),
- grpc.UnaryInterceptor(grpcmw.ChainUnaryServer(
+ ),
+ grpc.ChainUnaryInterceptor(
auth.UnaryServerInterceptor(gitalycfgauth.Config{
Token: creds,
}),
- )),
+ ),
}
}
diff --git a/go.mod b/go.mod
index 545270027..94e3bcf29 100644
--- a/go.mod
+++ b/go.mod
@@ -18,7 +18,7 @@ require (
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.3.0
- github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
+ github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/hashicorp/golang-lru/v2 v2.0.2
github.com/hashicorp/yamux v0.1.1
diff --git a/go.sum b/go.sum
index 5b5e8f041..5bbfa694a 100644
--- a/go.sum
+++ b/go.sum
@@ -1302,8 +1302,9 @@ github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd/go.mod h1:M5qHK+eWf
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
-github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw=
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y=
+github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI=
+github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
@@ -2206,6 +2207,7 @@ go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
+go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI=
go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
gocloud.dev v0.29.0 h1:fBy0jwJSmxs0IjT0fE32MO+Mj+307VZQwyHaTyFZbC4=
diff --git a/internal/gitaly/server/server.go b/internal/gitaly/server/server.go
index d1ee729aa..0a3730be9 100644
--- a/internal/gitaly/server/server.go
+++ b/internal/gitaly/server/server.go
@@ -5,7 +5,6 @@ import (
"fmt"
"time"
- grpcmw "github.com/grpc-ecosystem/go-grpc-middleware"
grpcmwlogrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
grpcmwtags "github.com/grpc-ecosystem/go-grpc-middleware/tags"
grpcprometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
@@ -181,8 +180,8 @@ func (s *GitalyServerFactory) New(secure bool, opts ...Option) (*grpc.Server, er
FieldProducers: []gitalylog.FieldsProducer{grpcstats.FieldsProducer},
}),
grpc.Creds(lm),
- grpc.StreamInterceptor(grpcmw.ChainStreamServer(streamServerInterceptors...)),
- grpc.UnaryInterceptor(grpcmw.ChainUnaryServer(unaryServerInterceptors...)),
+ grpc.ChainStreamInterceptor(streamServerInterceptors...),
+ grpc.ChainUnaryInterceptor(unaryServerInterceptors...),
// We deliberately set the server MinTime to significantly less than the client interval of 20
// seconds to allow for network jitter. We can afford to be forgiving as the maximum number of
// concurrent clients for a Gitaly server is typically in the hundreds and this volume of
diff --git a/internal/log/log_test.go b/internal/log/log_test.go
index 763c63b5d..4ce6cf105 100644
--- a/internal/log/log_test.go
+++ b/internal/log/log_test.go
@@ -36,33 +36,29 @@ func TestPayloadBytes(t *testing.T) {
Underlying: &grpcstats.PayloadBytes{},
FieldProducers: []FieldsProducer{grpcstats.FieldsProducer},
}),
- grpc.UnaryInterceptor(
- grpcmw.ChainUnaryServer(
- grpcmwlogrus.UnaryServerInterceptor(
- logrus.NewEntry(logger),
- grpcmwlogrus.WithMessageProducer(
- MessageProducer(
- PropagationMessageProducer(grpcmwlogrus.DefaultMessageProducer),
- grpcstats.FieldsProducer,
- ),
+ grpc.ChainUnaryInterceptor(
+ grpcmwlogrus.UnaryServerInterceptor(
+ logrus.NewEntry(logger),
+ grpcmwlogrus.WithMessageProducer(
+ MessageProducer(
+ PropagationMessageProducer(grpcmwlogrus.DefaultMessageProducer),
+ grpcstats.FieldsProducer,
),
),
- UnaryLogDataCatcherServerInterceptor(),
),
+ UnaryLogDataCatcherServerInterceptor(),
),
- grpc.StreamInterceptor(
- grpcmw.ChainStreamServer(
- grpcmwlogrus.StreamServerInterceptor(
- logrus.NewEntry(logger),
- grpcmwlogrus.WithMessageProducer(
- MessageProducer(
- PropagationMessageProducer(grpcmwlogrus.DefaultMessageProducer),
- grpcstats.FieldsProducer,
- ),
+ grpc.ChainStreamInterceptor(
+ grpcmwlogrus.StreamServerInterceptor(
+ logrus.NewEntry(logger),
+ grpcmwlogrus.WithMessageProducer(
+ MessageProducer(
+ PropagationMessageProducer(grpcmwlogrus.DefaultMessageProducer),
+ grpcstats.FieldsProducer,
),
),
- StreamLogDataCatcherServerInterceptor(),
),
+ StreamLogDataCatcherServerInterceptor(),
),
}
diff --git a/internal/middleware/commandstatshandler/commandstatshandler_test.go b/internal/middleware/commandstatshandler/commandstatshandler_test.go
index 4caac7eee..dd79554e8 100644
--- a/internal/middleware/commandstatshandler/commandstatshandler_test.go
+++ b/internal/middleware/commandstatshandler/commandstatshandler_test.go
@@ -6,7 +6,6 @@ import (
"net"
"testing"
- grpcmw "github.com/grpc-ecosystem/go-grpc-middleware"
grpcmwlogrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
@@ -37,18 +36,18 @@ func createNewServer(t *testing.T, cfg config.Cfg, logger *logrus.Logger) *grpc.
logrusEntry := logrus.NewEntry(logger).WithField("test", t.Name())
opts := []grpc.ServerOption{
- grpc.StreamInterceptor(grpcmw.ChainStreamServer(
+ grpc.ChainStreamInterceptor(
StreamInterceptor,
grpcmwlogrus.StreamServerInterceptor(logrusEntry,
grpcmwlogrus.WithTimestampFormat(log.LogTimestampFormat),
grpcmwlogrus.WithMessageProducer(log.MessageProducer(grpcmwlogrus.DefaultMessageProducer, FieldsProducer))),
- )),
- grpc.UnaryInterceptor(grpcmw.ChainUnaryServer(
+ ),
+ grpc.ChainUnaryInterceptor(
UnaryInterceptor,
grpcmwlogrus.UnaryServerInterceptor(logrusEntry,
grpcmwlogrus.WithTimestampFormat(log.LogTimestampFormat),
grpcmwlogrus.WithMessageProducer(log.MessageProducer(grpcmwlogrus.DefaultMessageProducer, FieldsProducer))),
- )),
+ ),
}
server := grpc.NewServer(opts...)
diff --git a/internal/middleware/featureflag/featureflag_handler_test.go b/internal/middleware/featureflag/featureflag_handler_test.go
index 8cefba813..7d2f39e82 100644
--- a/internal/middleware/featureflag/featureflag_handler_test.go
+++ b/internal/middleware/featureflag/featureflag_handler_test.go
@@ -5,7 +5,6 @@ import (
"net"
"testing"
- grpcmw "github.com/grpc-ecosystem/go-grpc-middleware"
grpcmwlogrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
@@ -40,7 +39,7 @@ func TestFeatureFlagLogs(t *testing.T) {
service := &mockService{}
server := grpc.NewServer(
- grpcmw.WithUnaryServerChain(
+ grpc.ChainUnaryInterceptor(
grpcmwlogrus.UnaryServerInterceptor(
logrus.NewEntry(logger),
grpcmwlogrus.WithMessageProducer(
diff --git a/internal/middleware/limithandler/stats_interceptor_test.go b/internal/middleware/limithandler/stats_interceptor_test.go
index 0dc9a27bd..5dc641100 100644
--- a/internal/middleware/limithandler/stats_interceptor_test.go
+++ b/internal/middleware/limithandler/stats_interceptor_test.go
@@ -6,7 +6,6 @@ import (
"net"
"testing"
- grpcmw "github.com/grpc-ecosystem/go-grpc-middleware"
grpcmwlogrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
@@ -39,20 +38,20 @@ func createNewServer(t *testing.T, cfg config.Cfg, logger *logrus.Logger) *grpc.
)
opts := []grpc.ServerOption{
- grpc.StreamInterceptor(grpcmw.ChainStreamServer(
+ grpc.ChainStreamInterceptor(
limithandler.StatsStreamInterceptor,
grpcmwlogrus.StreamServerInterceptor(logrusEntry,
grpcmwlogrus.WithTimestampFormat(log.LogTimestampFormat),
grpcmwlogrus.WithMessageProducer(log.MessageProducer(grpcmwlogrus.DefaultMessageProducer, limithandler.FieldsProducer))),
concurrencyLimitHandler.StreamInterceptor(),
- )),
- grpc.UnaryInterceptor(grpcmw.ChainUnaryServer(
+ ),
+ grpc.ChainUnaryInterceptor(
limithandler.StatsUnaryInterceptor,
grpcmwlogrus.UnaryServerInterceptor(logrusEntry,
grpcmwlogrus.WithTimestampFormat(log.LogTimestampFormat),
grpcmwlogrus.WithMessageProducer(log.MessageProducer(grpcmwlogrus.DefaultMessageProducer, limithandler.FieldsProducer))),
concurrencyLimitHandler.UnaryInterceptor(),
- )),
+ ),
}
server := grpc.NewServer(opts...)
diff --git a/internal/praefect/grpc-proxy/proxy/testhelper_test.go b/internal/praefect/grpc-proxy/proxy/testhelper_test.go
index 4a8dd5aa0..65b59afcc 100644
--- a/internal/praefect/grpc-proxy/proxy/testhelper_test.go
+++ b/internal/praefect/grpc-proxy/proxy/testhelper_test.go
@@ -7,7 +7,6 @@ import (
"net"
"testing"
- grpcmw "github.com/grpc-ecosystem/go-grpc-middleware"
grpcmwtags "github.com/grpc-ecosystem/go-grpc-middleware/tags"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/helper/fieldextractors"
@@ -67,13 +66,11 @@ func newBackendPinger(tb testing.TB, ctx context.Context) (*grpc.ClientConn, *in
func newProxy(tb testing.TB, ctx context.Context, director proxy.StreamDirector, svc, method string) *grpc.ClientConn {
proxySrvr := grpc.NewServer(
grpc.ForceServerCodec(proxy.NewCodec()),
- grpc.StreamInterceptor(
- grpcmw.ChainStreamServer(
- // context tags usage is required by sentryhandler.StreamLogHandler
- grpcmwtags.StreamServerInterceptor(grpcmwtags.WithFieldExtractorForInitialReq(fieldextractors.FieldExtractor)),
- // sentry middleware to capture errors
- sentryhandler.StreamLogHandler,
- ),
+ grpc.ChainStreamInterceptor(
+ // context tags usage is required by sentryhandler.StreamLogHandler
+ grpcmwtags.StreamServerInterceptor(grpcmwtags.WithFieldExtractorForInitialReq(fieldextractors.FieldExtractor)),
+ // sentry middleware to capture errors
+ sentryhandler.StreamLogHandler,
),
grpc.UnknownServiceHandler(proxy.TransparentHandler(director)),
)
diff --git a/internal/praefect/server.go b/internal/praefect/server.go
index 8c46f6d2d..8a97fc395 100644
--- a/internal/praefect/server.go
+++ b/internal/praefect/server.go
@@ -7,7 +7,6 @@ package praefect
import (
"time"
- grpcmw "github.com/grpc-ecosystem/go-grpc-middleware"
grpcmwlogrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
grpcmwtags "github.com/grpc-ecosystem/go-grpc-middleware/tags"
grpcprometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
@@ -50,9 +49,9 @@ func NewBackchannelServerFactory(logger *logrus.Entry, refSvc gitalypb.RefTransa
lm := listenmux.New(insecure.NewCredentials())
lm.Register(sidechannel.NewServerHandshaker(registry))
srv := grpc.NewServer(
- grpc.UnaryInterceptor(grpcmw.ChainUnaryServer(
+ grpc.ChainUnaryInterceptor(
commonUnaryServerInterceptors(logger)...,
- )),
+ ),
grpc.Creds(lm),
)
gitalypb.RegisterRefTransactionServer(srv, refSvc)
@@ -116,14 +115,14 @@ func NewGRPCServer(
grpcOpts = append(grpcOpts, proxyRequiredOpts(director)...)
grpcOpts = append(grpcOpts, []grpc.ServerOption{
- grpc.StreamInterceptor(grpcmw.ChainStreamServer(streamInterceptors...)),
- grpc.UnaryInterceptor(grpcmw.ChainUnaryServer(
+ grpc.ChainStreamInterceptor(streamInterceptors...),
+ grpc.ChainUnaryInterceptor(
append(
commonUnaryServerInterceptors(logger),
middleware.MethodTypeUnaryInterceptor(registry),
auth.UnaryServerInterceptor(conf.Auth),
)...,
- )),
+ ),
// We deliberately set the server MinTime to significantly less than the client interval of 20
// seconds to allow for network jitter. We can afford to be forgiving as the maximum number of
// concurrent clients for a Gitaly server is typically in the hundreds and this volume of
diff --git a/internal/structerr/grpc_server_test.go b/internal/structerr/grpc_server_test.go
index 6d2bb39b3..e221027ba 100644
--- a/internal/structerr/grpc_server_test.go
+++ b/internal/structerr/grpc_server_test.go
@@ -7,7 +7,6 @@ import (
"net"
"testing"
- grpcmw "github.com/grpc-ecosystem/go-grpc-middleware"
grpcmwlogrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
@@ -96,7 +95,7 @@ func TestFieldsProducer(t *testing.T) {
service := &mockService{}
server := grpc.NewServer(
- grpcmw.WithUnaryServerChain(
+ grpc.ChainUnaryInterceptor(
grpcmwlogrus.UnaryServerInterceptor(
logrus.NewEntry(logger),
grpcmwlogrus.WithMessageProducer(