Skip to content

Pass CORRELATION_ID env variable to spawned git subprocesses

Igor requested to merge env-inject-correlation-id into master

This patch adds a CORRELATION_ID env variable to the git processes.

That allows figuring out which RPC a git request came from, by doing this:

sudo cat /proc/$(pgrep -n -f 'git cat-file')/environ | tr '\0' '\n'

@andrewn pointed towards the existing implementation of this in labkit which is already used in two other places in gitaly:

  • internal/gitalyssh/gitalyssh.go
  • internal/supervisor/supervisor.go

The proposal is to add that for all git subprocesses. This may make it easier to correlate a process with its originating RPC during incidents.

Example incident that spawned this: gitlab-com/gl-infra/production#2528 (comment 397044210).

Edited by Igor

Merge request reports