-
- Downloads
Make it possible to propagate correlation ID across processes
Previously, gitlab-shell did not pass a context through the application. Correlation IDs were generated down the call stack instead of passed around from the start execution. This has several potential downsides: 1. It's easier for programming mistakes to be made in future that lead to multiple correlation IDs being generated for a single request. 2. Correlation IDs cannot be passed in from upstream requests 3. Other advantages of context passing, such as distributed tracing is not possible. This commit changes the behavior: 1. Extract the correlation ID from the environment at the start of the application. 2. If no correlation ID exists, generate a random one. 3. Pass the correlation ID to the GitLabNet API requests. This change also enables other clients of GitLabNet (e.g. Gitaly) to pass along the correlation ID in the internal API requests (https://gitlab.com/gitlab-org/gitaly/-/issues/2725). Fixes https://gitlab.com/gitlab-org/gitlab-shell/-/issues/474
Showing
- client/client_test.go 11 additions, 10 deletionsclient/client_test.go
- client/gitlabnet.go 11 additions, 17 deletionsclient/gitlabnet.go
- client/httpclient_test.go 4 additions, 3 deletionsclient/httpclient_test.go
- client/httpsclient_test.go 3 additions, 2 deletionsclient/httpsclient_test.go
- cmd/check/main.go 4 additions, 1 deletioncmd/check/main.go
- cmd/gitlab-shell-authorized-keys-check/main.go 4 additions, 1 deletioncmd/gitlab-shell-authorized-keys-check/main.go
- cmd/gitlab-shell-authorized-principals-check/main.go 4 additions, 1 deletioncmd/gitlab-shell-authorized-principals-check/main.go
- cmd/gitlab-shell/main.go 4 additions, 1 deletioncmd/gitlab-shell/main.go
- go.sum 1 addition, 0 deletionsgo.sum
- internal/command/authorizedkeys/authorized_keys.go 7 additions, 6 deletionsinternal/command/authorizedkeys/authorized_keys.go
- internal/command/authorizedkeys/authorized_keys_test.go 2 additions, 1 deletioninternal/command/authorizedkeys/authorized_keys_test.go
- internal/command/authorizedprincipals/authorized_principals.go 2 additions, 1 deletion...nal/command/authorizedprincipals/authorized_principals.go
- internal/command/authorizedprincipals/authorized_principals_test.go 2 additions, 1 deletion...ommand/authorizedprincipals/authorized_principals_test.go
- internal/command/command.go 28 additions, 1 deletioninternal/command/command.go
- internal/command/command_test.go 66 additions, 0 deletionsinternal/command/command_test.go
- internal/command/discover/discover.go 5 additions, 4 deletionsinternal/command/discover/discover.go
- internal/command/discover/discover_test.go 3 additions, 2 deletionsinternal/command/discover/discover_test.go
- internal/command/healthcheck/healthcheck.go 5 additions, 4 deletionsinternal/command/healthcheck/healthcheck.go
- internal/command/healthcheck/healthcheck_test.go 4 additions, 3 deletionsinternal/command/healthcheck/healthcheck_test.go
- internal/command/lfsauthenticate/lfsauthenticate.go 8 additions, 7 deletionsinternal/command/lfsauthenticate/lfsauthenticate.go
Loading
| Loading
| @@ -248,6 +248,7 @@ github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb6 |
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= | ||
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= | ||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= | ||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= | ||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= | ||
Loading
| Loading
|
Please register or sign in to comment