diff options
author | Stan Hu <stanhu@gmail.com> | 2020-11-01 20:52:24 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2020-11-01 20:52:24 -0800 |
commit | 5ef496ff41ab9893a8dd1fad879879dbeb92ce36 (patch) | |
tree | e6fa696571101ecb35ea9d016246c1210295d963 /client/gitlabnet.go | |
parent | 027c8c366bd6bac4b291577f10b2c13ffc5a6cc1 (diff) | |
download | gitlab-shell-sh-log-content-length-bytes.tar.gz |
Log Content-Length bytes in API requestsh-log-content-length-bytes
This will be useful to measure bandwidth sent with API requests,
particularly with measuring the /api/v4/internal/lfs endpoint.
Diffstat (limited to 'client/gitlabnet.go')
-rw-r--r-- | client/gitlabnet.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/client/gitlabnet.go b/client/gitlabnet.go index fcefb24..a5b22ee 100644 --- a/client/gitlabnet.go +++ b/client/gitlabnet.go @@ -156,6 +156,10 @@ func (c *GitlabNetClient) DoRequest(ctx context.Context, method, path string, da return nil, err } + if response.ContentLength >= 0 { + logger = logger.WithField("content_length_bytes", response.ContentLength) + } + logger.Info("Finished HTTP request") return response, nil |