Skip to content

Propagate Correlation ID and Remote IP to and from gitaly-hooks

Quang-Minh Nguyen requested to merge qmnguyen0711/log-concurrency-ips into master

For Log pack-objects concurrency grouped by IP (#5012 - closed) and Propagate correlation ID into the PackObjectsHo... (#4979 - closed). While two issues are not relevant, their resulting changes are highly overlapped. So, I would like to fix them in one go.


This MR adds Correlation ID and Remote IP propagation from Gitaly to gitaly-hooks and from gitaly-hooks to subsequent RPCs.

Correlation ID is the most common baggage data passed around GitLab services. Services usually attach it (and other metadata) as gRPC metadata. It is then handled at gRPC interceptor layer. The interceptors embed it as fields of application context. Typically, gRPC client automatically attaches it. This is not the case for gitaly-hooks. It doesn't contain the proper configuration. As a result, this field is missing.

Remote IP is another interesting metadata. Originally, this field is for logging and debugging only. From some recent discussions, we raise an interest in using this data to control the concurrency of pack-objects command. This MR propagates Remote IP from gitaly-hooks and passes it to PackObjectsHook RPC. At this point, RemoteIP is added to the request proto of the RPC to make it consistent with the existing fields. In the future, we may consider find a more generic solutions for other RPC.

Before

Screenshot_2023-03-28_at_15.38.17

After

Screenshot_2023-03-28_at_16.27.46

Screenshot_2023-03-28_at_16.28.09

Screenshot_2023-03-28_at_17.50.29

Edited by Quang-Minh Nguyen

Merge request reports