From 0f2c4b3b68d8ec5b2273c23e478feed34cdf7176 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Fri, 12 Jul 2019 16:54:31 -0700 Subject: [PATCH] httpclient: Create trace logging for outgoing HTTP requests Sometimes HTTP requests are buried inside third-party libraries where we can't otherwise access their request method/URL, so this ensures we'll always have at least a record of the fact that a request happened, even if there's no other logging for why it did. We only include the method and URL here under the assumption that secret keys and other particularly sensitive information will not appear there, in line with usual best-practices. --- httpclient/useragent.go | 1 + 1 file changed, 1 insertion(+) diff --git a/httpclient/useragent.go b/httpclient/useragent.go index 5e28017688..0e13e58344 100644 --- a/httpclient/useragent.go +++ b/httpclient/useragent.go @@ -36,5 +36,6 @@ func (rt *userAgentRoundTripper) RoundTrip(req *http.Request) (*http.Response, e if _, ok := req.Header["User-Agent"]; !ok { req.Header.Set("User-Agent", rt.userAgent) } + log.Printf("[TRACE] HTTP client %s request to %s", req.Method, req.URL.String()) return rt.inner.RoundTrip(req) }