Prepare 'gitaly-debug analyze-http-clone' for prometheus
For #1737 (closed) we want structured clone analysis data. This MR refactors gitaly-debug analyze-http-clone
so that the numbers it collects can be made to go into Prometheus gauges in a follow-up MR.
The point here is to collect the various data points we acquire in a struct, so that in a follow up MR, we can publish those struct values as prometheus gauges.
This significantly changes the output of gitaly-debug analyze-http-clone
but I think that is OK. See (collapsed) examples below.
Before
---
--- GET https://gitlab.com/gitlab-org/gitlab-test.git/info/refs?service=git-upload-pack
---
response after 788.090179ms
response header: map[Cache-Control:[no-cache] Content-Encoding:[gzip] Content-Type:[application/x-git-upload-pack-advertisement] Date:[Wed, 04 Dec 2019 15:56:35 GMT] Gitlab-Lb:[fe-01-lb-gprd] Gitlab-Sv:[git-cny-01-sv-gprd] Referrer-Policy:[strict-origin-when-cross-origin] Server:[nginx] Strict-Transport-Security:[max-age=31536000]]
HTTP status code 200
first packet 788.661753ms
received 165 packets
done in 788.816677ms
payload data: 11370 bytes
received 162 refs, selected 104 wants
---
--- POST https://gitlab.com/gitlab-org/gitlab-test.git/git-upload-pack
---
response after 409.863883ms
response header: map[Cache-Control:[no-cache] Content-Type:[application/x-git-upload-pack-result] Date:[Wed, 04 Dec 2019 15:56:36 GMT] Gitlab-Lb:[fe-01-lb-gprd] Gitlab-Sv:[git-cny-02-sv-gprd] Referrer-Policy:[strict-origin-when-cross-origin] Server:[nginx] Strict-Transport-Security:[max-age=31536000]]
HTTP status code 200
received NAK after 524.862277ms
received first progress packet after 524.891585ms
Enumerating objects: 1171, done.
Compressing objects: 100% (531/531), done.
received first pack packet after 540.192405ms
.............Total 1171 (delta 540), reused 1149 (delta 529)
received 1477 packets
done in 2.720089937s
pack band: 11208007 payload bytes, 1370 packets
progress band: 7220 payload bytes, 105 packets
error band: 0 payload bytes, 0 packets
packet payload size histogram: map[1:1 32:1 33:2 34:25 35:9 36:10 42:1 43:1 48:1 50:1 68:16 70:5 72:2 77:1 104:1 108:2 116:1 119:1 128:25 1351:1 8191:1 8192:1367]
After
---
--- GET https://gitlab.com/gitlab-org/gitlab-test.git/info/refs?service=git-upload-pack
---
response code: 200
response header: map[Cache-Control:[no-cache] Content-Encoding:[gzip] Content-Type:[application/x-git-upload-pack-advertisement] Date:[Tue, 17 Dec 2019 16:05:29 GMT] Gitlab-Lb:[fe-06-lb-gprd] Gitlab-Sv:[git-cny-02-sv-gprd] Referrer-Policy:[strict-origin-when-cross-origin] Server:[nginx] Strict-Transport-Security:[max-age=31536000]]
---
--- POST https://gitlab.com/gitlab-org/gitlab-test.git/git-upload-pack
---
response code: 200
response header: map[Cache-Control:[no-cache] Content-Type:[application/x-git-upload-pack-result] Date:[Tue, 17 Dec 2019 16:05:30 GMT] Gitlab-Lb:[fe-06-lb-gprd] Gitlab-Sv:[git-cny-02-sv-gprd] Referrer-Policy:[strict-origin-when-cross-origin] Server:[nginx] Strict-Transport-Security:[max-age=31536000]]
Enumerating objects: 1171, done.
Compressing objects: 100% (531/531), done.
..............Total 1171 (delta 540), reused 1149 (delta 529)
--- GET metrics:
response header time 684.884512ms
first Git packet 685.47385ms
response body time 685.582682ms
payload size 11370
Git packets received 165
refs advertised 162
wanted refs 104
--- POST metrics:
response header time 273.623362ms
time to server NAK 273.701142ms
response body time 2.151545546s
largest single Git packet payload 8192
Git packets received 1508
--- POST pack band
time to first packet 382.34256ms
packets 1370
total payload size 11208007
--- POST progress band
time to first packet 273.702696ms
packets 136
total payload size 7220