summaryrefslogtreecommitdiff
path: root/client/gitlabnet.go
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2020-11-01 20:52:24 -0800
committerStan Hu <stanhu@gmail.com>2020-11-01 20:52:24 -0800
commit5ef496ff41ab9893a8dd1fad879879dbeb92ce36 (patch)
treee6fa696571101ecb35ea9d016246c1210295d963 /client/gitlabnet.go
parent027c8c366bd6bac4b291577f10b2c13ffc5a6cc1 (diff)
downloadgitlab-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.go4
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