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:
authorPavlo Strokov <pstrokov@gitlab.com>2020-09-08 13:07:22 +0300
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2020-09-08 13:07:22 +0300
commitd87f0757c880a28b20338fd9533495688eeece95 (patch)
tree35f26f53712adee29f8c92c36a57e00c0b249bcc /internal/testhelper
parent785bebf7fb05c6c4457c75c011a01b1bede3f3a9 (diff)
Pass correlation_id over to gitaly-ssh
When gitaly-ssh is called it doesn't receive correlation_id. That is why it is hard to understand what to what chain of calls this call is related. correlation_id passed as env var 'CORRELATION_ID' to gitaly-ssh process. So it would be picked by it and used in outgoing requests. In order to cover other missing parts where correlation_id should be passed the client.DialContext method includes interceptors for it by default. If correlation_id is present in the context.Context used to invoke the method it will be passed to the remote. Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/3047
Diffstat (limited to 'internal/testhelper')
-rw-r--r--internal/testhelper/testserver.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/internal/testhelper/testserver.go b/internal/testhelper/testserver.go
index 8ccbcb6eb..c4c112e18 100644
--- a/internal/testhelper/testserver.go
+++ b/internal/testhelper/testserver.go
@@ -35,6 +35,7 @@ import (
praefectconfig "gitlab.com/gitlab-org/gitaly/internal/praefect/config"
serverauth "gitlab.com/gitlab-org/gitaly/internal/server/auth"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
+ grpccorrelation "gitlab.com/gitlab-org/labkit/correlation/grpc"
"google.golang.org/grpc"
"google.golang.org/grpc/health"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
@@ -298,11 +299,18 @@ func NewServer(tb testing.TB, streamInterceptors []grpc.StreamServerInterceptor,
logrusEntry := log.NewEntry(logger).WithField("test", tb.Name())
ctxTagger := grpc_ctxtags.WithFieldExtractorForInitialReq(fieldextractors.FieldExtractor)
- ctxStreamTagger := grpc_ctxtags.StreamServerInterceptor(ctxTagger)
- ctxUnaryTagger := grpc_ctxtags.UnaryServerInterceptor(ctxTagger)
- streamInterceptors = append([]grpc.StreamServerInterceptor{ctxStreamTagger, grpc_logrus.StreamServerInterceptor(logrusEntry)}, streamInterceptors...)
- unaryInterceptors = append([]grpc.UnaryServerInterceptor{ctxUnaryTagger, grpc_logrus.UnaryServerInterceptor(logrusEntry)}, unaryInterceptors...)
+ streamInterceptors = append([]grpc.StreamServerInterceptor{
+ grpc_ctxtags.StreamServerInterceptor(ctxTagger),
+ grpccorrelation.StreamServerCorrelationInterceptor(),
+ grpc_logrus.StreamServerInterceptor(logrusEntry),
+ }, streamInterceptors...)
+
+ unaryInterceptors = append([]grpc.UnaryServerInterceptor{
+ grpc_ctxtags.UnaryServerInterceptor(ctxTagger),
+ grpccorrelation.UnaryServerCorrelationInterceptor(),
+ grpc_logrus.UnaryServerInterceptor(logrusEntry),
+ }, unaryInterceptors...)
return NewTestServer(
grpc.NewServer(