mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* Update go-kit/kit to 0.12.0 to fix spurious debug logs This version of go-kit/kit/log is just a pass-through to go-kit/log. Also updates a number of dependencies, including the following: * github.com/aws/aws-sdk-go from v1.38.68 to v1.40.45 * github.com/go-kit/log from v0.1.0 to v0.2.0 * github.com/json-iterator/go from v1.1.11 to v1.1.12 * github.com/hashicorp/go-hclog from v0.14.0 to v0.16.2 * github.com/klauspost/compress from v1.13.5 to v1.13.6 * golang.org/x/net from ad29c8ab022f to 978cfadd31cf None of these changes looks material to Tempo. After update, ran `go mod tidy -go=1.16 && go mod tidy -go=1.17`. This makes `make vendor-check` pass; I don't think it actually changes what gets linked. * Replace calls to go-kit/kit/log with go-kit/log They are identical - the first is a pass-through to the latter - but the linter generates errors due to go-kit/kit/log being marked deprecated. * Update CHANGELOG * go mod tidy Co-authored-by: Martin Disibio <[email protected]>
59 lines
1.8 KiB
Go
59 lines
1.8 KiB
Go
package cleanhttp
|
|
|
|
import (
|
|
"net"
|
|
"net/http"
|
|
"runtime"
|
|
"time"
|
|
)
|
|
|
|
// DefaultTransport returns a new http.Transport with similar default values to
|
|
// http.DefaultTransport, but with idle connections and keepalives disabled.
|
|
func DefaultTransport() *http.Transport {
|
|
transport := DefaultPooledTransport()
|
|
transport.DisableKeepAlives = true
|
|
transport.MaxIdleConnsPerHost = -1
|
|
return transport
|
|
}
|
|
|
|
// DefaultPooledTransport returns a new http.Transport with similar default
|
|
// values to http.DefaultTransport. Do not use this for transient transports as
|
|
// it can leak file descriptors over time. Only use this for transports that
|
|
// will be re-used for the same host(s).
|
|
func DefaultPooledTransport() *http.Transport {
|
|
transport := &http.Transport{
|
|
Proxy: http.ProxyFromEnvironment,
|
|
DialContext: (&net.Dialer{
|
|
Timeout: 30 * time.Second,
|
|
KeepAlive: 30 * time.Second,
|
|
DualStack: true,
|
|
}).DialContext,
|
|
MaxIdleConns: 100,
|
|
IdleConnTimeout: 90 * time.Second,
|
|
TLSHandshakeTimeout: 10 * time.Second,
|
|
ExpectContinueTimeout: 1 * time.Second,
|
|
ForceAttemptHTTP2: true,
|
|
MaxIdleConnsPerHost: runtime.GOMAXPROCS(0) + 1,
|
|
}
|
|
return transport
|
|
}
|
|
|
|
// DefaultClient returns a new http.Client with similar default values to
|
|
// http.Client, but with a non-shared Transport, idle connections disabled, and
|
|
// keepalives disabled.
|
|
func DefaultClient() *http.Client {
|
|
return &http.Client{
|
|
Transport: DefaultTransport(),
|
|
}
|
|
}
|
|
|
|
// DefaultPooledClient returns a new http.Client with similar default values to
|
|
// http.Client, but with a shared Transport. Do not use this function for
|
|
// transient clients as it can leak file descriptors over time. Only use this
|
|
// for clients that will be re-used for the same host(s).
|
|
func DefaultPooledClient() *http.Client {
|
|
return &http.Client{
|
|
Transport: DefaultPooledTransport(),
|
|
}
|
|
}
|