httptransport

package
v1.64.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2022 License: MIT, BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTTFBTimeout is the timeout used in the meteredRoundTripper
	// when calling http.Transport.RoundTrip. The request will be cancelled
	// if the response takes longer than this.
	DefaultTTFBTimeout = 15 * time.Second
)

Variables

View Source
var (

	// DefaultTransport can be used with http.Client with TLS and certificates
	DefaultTransport = NewTransport()
)

Functions

func NewMeteredRoundTripper added in v1.35.0

func NewMeteredRoundTripper(transport http.RoundTripper, name string, tracerVec, durationsVec *prometheus.
	HistogramVec, counterVec *prometheus.CounterVec, ttfbTimeout time.Duration) http.RoundTripper

NewMeteredRoundTripper will create a custom http.RoundTripper that can be used with an http.Client. The RoundTripper will report metrics based on the collectors passed.

func NewTransport added in v1.35.0

func NewTransport() *http.Transport

NewTransport initializes an http.Transport with a custom dialer that includes TLS Root CAs. It sets default connection values such as timeouts and max idle connections.

Types

type Transport

type Transport interface {
	http.RoundTripper
	RegisterProtocol(scheme string, rt http.RoundTripper)
}

Transport wraps a RoundTripper so it can be extended and modified outside of this package

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL