From 5ef496ff41ab9893a8dd1fad879879dbeb92ce36 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 1 Nov 2020 20:52:24 -0800 Subject: Log Content-Length bytes in API request This will be useful to measure bandwidth sent with API requests, particularly with measuring the /api/v4/internal/lfs endpoint. --- client/gitlabnet.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'client/gitlabnet.go') 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 -- cgit v1.2.1