Skip to content

Make it possible to propagate correlation ID across processes

Stan Hu requested to merge sh-extract-context-from-env into master

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 (gitaly#2725 (closed)).

Fixes #474 (closed)

Edited by Stan Hu

Merge request reports