gitlabnet: add correlation id to logs
In the GitLab client there are various logs without any correlation id which makes it hard to find the related logs. We are adding the correlation id to make it easier to find the related logs.
I've also extended the current unit tests to include cases where server is unreachable or returns error.
I have tested the changes in gdk by pushing commits to a repo, and following logs were produced:
2024-07-17_13:52:48.16598 [31;1mpraefect-gitaly-0 : [0m{"correlation_id":"01J30FF2QXV3EKSXGT2QFDRG1R","duration_ms":271,"level":"info","method":"POST","msg":"Finished HTTP request","pid":43299,"status":200,"time":"2024-07-17T13:52:48.165Z","url":"http://gdk.test:3000/api/v4/internal/allowed"}
2024-07-17_13:52:48.18491 [31;1mpraefect-gitaly-0 : [0m{"correlation_id":"01J30FF2QXV3EKSXGT2QFDRG1R","duration_ms":17,"level":"info","method":"POST","msg":"Finished HTTP request","pid":43299,"status":200,"time":"2024-07-17T13:52:48.184Z","url":"http://gdk.test:3000/api/v4/internal/pre_receive"}
2024-07-17_13:52:48.36606 [31;1mpraefect-gitaly-0 : [0m{"correlation_id":"01J30FF2QXV3EKSXGT2QFDRG1R","duration_ms":51,"level":"info","method":"POST","msg":"Finished HTTP request","pid":43299,"status":200,"time":"2024-07-17T13:52:48.366Z","url":"http://gdk.test:3000/api/v4/internal/post_receive"}
As we can see, correlation_id is added.
Closes #5860 (closed)
Edited by Mustafa Bayar