diff options
author | Igor Drozdov <idrozdov@gitlab.com> | 2021-07-22 17:58:58 +0300 |
---|---|---|
committer | Igor Drozdov <idrozdov@gitlab.com> | 2021-07-22 18:38:47 +0300 |
commit | fb7b9417842c66e12466e658e861e19619dfcd9a (patch) | |
tree | d0d49465ee51299ed97f404e1aeebd92b6f9ff9e /internal/handler/exec.go | |
parent | a8b2088d6d40e365445fcf4bea5183f83e31cc51 (diff) | |
download | gitlab-shell-fb7b9417842c66e12466e658e861e19619dfcd9a.tar.gz |
Switch to labkit/log for logging functionality
Diffstat (limited to 'internal/handler/exec.go')
-rw-r--r-- | internal/handler/exec.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/internal/handler/exec.go b/internal/handler/exec.go index fd0ea89..89856f7 100644 --- a/internal/handler/exec.go +++ b/internal/handler/exec.go @@ -8,19 +8,20 @@ import ( grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" - log "github.com/sirupsen/logrus" "google.golang.org/grpc" "google.golang.org/grpc/metadata" - gitalyauth "gitlab.com/gitlab-org/gitaly/v14/auth" - "gitlab.com/gitlab-org/gitaly/v14/client" - pb "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" "gitlab.com/gitlab-org/gitlab-shell/internal/config" "gitlab.com/gitlab-org/gitlab-shell/internal/gitlabnet/accessverifier" "gitlab.com/gitlab-org/gitlab-shell/internal/sshenv" - "gitlab.com/gitlab-org/labkit/correlation" + + gitalyauth "gitlab.com/gitlab-org/gitaly/v14/auth" + "gitlab.com/gitlab-org/gitaly/v14/client" + pb "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" grpccorrelation "gitlab.com/gitlab-org/labkit/correlation/grpc" grpctracing "gitlab.com/gitlab-org/labkit/tracing/grpc" + "gitlab.com/gitlab-org/labkit/correlation" + "gitlab.com/gitlab-org/labkit/log" ) // GitalyHandlerFunc implementations are responsible for making @@ -75,7 +76,6 @@ func (gc *GitalyCommand) PrepareContext(ctx context.Context, repository *pb.Repo func (gc *GitalyCommand) LogExecution(ctx context.Context, repository *pb.Repository, response *accessverifier.Response, env sshenv.Env) { fields := log.Fields{ "command": gc.ServiceName, - "correlation_id": correlation.ExtractFromContext(ctx), "gl_project_path": repository.GlProjectPath, "gl_repository": repository.GlRepository, "user_id": response.UserId, @@ -86,7 +86,7 @@ func (gc *GitalyCommand) LogExecution(ctx context.Context, repository *pb.Reposi "gl_key_id": response.KeyId, } - log.WithFields(fields).Info("executing git command") + log.WithContextFields(ctx, fields).Info("executing git command") } func withOutgoingMetadata(ctx context.Context, features map[string]string) context.Context { @@ -108,9 +108,9 @@ func getConn(ctx context.Context, gc *GitalyCommand) (*grpc.ClientConn, error) { serviceName := correlation.ExtractClientNameFromContext(ctx) if serviceName == "" { - log.Warn("No gRPC service name specified, defaulting to gitlab-shell-unknown") - serviceName = "gitlab-shell-unknown" + + log.WithFields(log.Fields{"service_name": serviceName}).Warn("No gRPC service name specified, defaulting to gitlab-shell-unknown") } serviceName = fmt.Sprintf("%s-%s", serviceName, gc.ServiceName) |