summaryrefslogtreecommitdiff
path: root/internal/handler
diff options
context:
space:
mode:
authorChangzheng Liu <cliu@gitlab.com>2020-05-21 22:35:56 -0700
committerChangzheng Liu <cliu@gitlab.com>2020-05-21 22:35:56 -0700
commit48b0bbd5aac1facb97d957122eef199ac84f5d72 (patch)
tree954b86b8d75a1e7dcc831c1c17084926e9ddb42e /internal/handler
parenta38da6c11864f98950f7145ab5707bd461d16e39 (diff)
downloadgitlab-shell-cl-client-name.tar.gz
Set client name when making requests to Gitalycl-client-name
Diffstat (limited to 'internal/handler')
-rw-r--r--internal/handler/exec.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/internal/handler/exec.go b/internal/handler/exec.go
index 3af0925..d6e06aa 100644
--- a/internal/handler/exec.go
+++ b/internal/handler/exec.go
@@ -8,12 +8,13 @@ import (
log "github.com/sirupsen/logrus"
- "gitlab.com/gitlab-org/gitaly/auth"
+ gitalyauth "gitlab.com/gitlab-org/gitaly/auth"
"gitlab.com/gitlab-org/gitaly/client"
pb "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
-
"gitlab.com/gitlab-org/gitlab-shell/internal/config"
+ "gitlab.com/gitlab-org/gitlab-shell/internal/executable"
"gitlab.com/gitlab-org/gitlab-shell/internal/gitlabnet/accessverifier"
+ grpccorrelation "gitlab.com/gitlab-org/labkit/correlation/grpc"
"gitlab.com/gitlab-org/labkit/tracing"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
@@ -87,7 +88,19 @@ func getConn(gc *GitalyCommand) (*GitalyConn, error) {
connOpts := client.DefaultDialOpts
if gc.Token != "" {
- connOpts = append(client.DefaultDialOpts, grpc.WithPerRPCCredentials(gitalyauth.RPCCredentialsV2(gc.Token)))
+ connOpts = append(client.DefaultDialOpts,
+ grpc.WithPerRPCCredentials(gitalyauth.RPCCredentialsV2(gc.Token)),
+ grpc.WithStreamInterceptor(
+ grpccorrelation.StreamClientCorrelationInterceptor(
+ grpccorrelation.WithClientName(executable.GitlabShell),
+ ),
+ ),
+ grpc.WithUnaryInterceptor(
+ grpccorrelation.UnaryClientCorrelationInterceptor(
+ grpccorrelation.WithClientName(executable.GitlabShell),
+ ),
+ ),
+ )
}
// Use a working directory that won't get removed or unmounted.