Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/canary: use default HTTP client when reading from Loki
The documentation[1] for net/http.Client says the following: A Client is an HTTP client. Its zero value (DefaultClient) is a usable client that uses DefaultTransport. The Client's Transport typically has internal state (cached TCP connections), so Clients should be reused instead of created as needed. Clients are safe for concurrent use by multiple goroutines. A Client is higher-level than a RoundTripper (such as Transport) and additionally handles HTTP details such as cookies and redirects. Canary was creating a new http.Client every time a query request was made to Loki, causing a new TCP connection to be established each time. If Loki has an outage, it's possible to get into a situation where all websocket requests are failing and for a high volume of requests to go through the normal query route. This can possibly lead to networking issues like socket starvation. [1]: https://golang.org/pkg/net/http/#Client
- Loading branch information