Skip to content

Export environment variables for git debugging

Andrew Newdigate requested to merge export-git-debugging-env-vars into master

Gitaly will re-export environment variables related to git tracing. This can help with debugging and diagnosing git related problems.

For example:

$ GIT_TRACE=true ./gitaly config.toml
...
INFO[0023] spawn                                         args=[/usr/local/bin/git -C /Users/andrewn/code/gitlab/gitlab-development-kit/repositories/gitlab/gitlab-design.git -c repack.writeBitmaps=true gc] grpc.method=GarbageCollect grpc.request.repoPath="gitlab/gitlab-design.git" grpc.request.repoStorage=default grpc.request.topLevelGroup=gitlab grpc.service=gitaly.RepositoryService path="/usr/local/bin/git" peer.address= span.kind=server system=grpc
12:39:16.368141 git.c:322               trace: built-in: git 'gc'
12:39:16.375757 run-command.c:626       trace: run_command: 'pack-refs' '--all' '--prune'
12:39:16.395086 git.c:322               trace: built-in: git 'pack-refs' '--all' '--prune'
12:39:16.405578 run-command.c:626       trace: run_command: 'reflog' 'expire' '--all'
12:39:16.410965 git.c:322               trace: built-in: git 'reflog' 'expire' '--all'
12:39:16.425053 run-command.c:626       trace: run_command: 'repack' '-d' '-l' '-A' '--unpack-unreachable=2.weeks.ago'
12:39:16.428031 git.c:322               trace: built-in: git 'repack' '-d' '-l' '-A' '--unpack-unreachable=2.weeks.ago'
12:39:16.429558 run-command.c:626       trace: run_command: 'pack-objects' '--keep-true-parents' '--non-empty' '--all' '--reflog' '--indexed-objects' '--write-bitmap-index' '--unpack-unreachable=2.weeks.ago' '--local' '--delta-base-offset' 'objects/pack/.tmp-56907-pack'
12:39:16.436098 git.c:322               trace: built-in: git 'pack-objects' '--keep-true-parents' '--non-empty' '--all' '--reflog' '--indexed-objects' '--write-bitmap-index' '--unpack-unreachable=2.weeks.ago' '--local' '--delta-base-offset' 'objects/pack/.tmp-56907-pack'

Update: additionally the MR now directs stderr of child processes to our logger in cases where it was going to stderr. This means that output from child processes can be analysed in the ELK stack.

Edited by Andrew Newdigate

Merge request reports