-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Hi, I am using the kit’s Client to make GET requests. For these requests I am looking to do some structured logging around the request (URL, headers, etc) response (Body, response code/status, etc). Unfortunately there is no logger as a part of the Client (like the Server) so I am looking for ways to best achieve my requirement without having logger being passed onto 5 different functions if possible.
One of the big limitations I am running into is if the underlying Client.Do method (https://github.com/go-kit/kit/blob/master/transport/http/client.go#L100) returns an error (like timeout), the decode response and even the clientAfterResponse functions are not called, for a good reason since there is nothing to decode. But there is something missing from the time when the call fails and the error is returned to caller. If you contrast this to the Server implementation, the Server does a good job I feel that if the execute method fails, it calls logger and calls a function to do more processing (such as encoding) the error.
Question is - why does the client not have a way to call a function (as an implementation option) to do post client.Do error processing where we can even hook up logging. It will be great if the framework can provide something, even if that could be optional like a ClientOption.