transport

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	HttpClientMetricsRequestsCount    = "http_client_requests_total"
	HttpClientMetricsRequestsDuration = "http_client_requests_duration_seconds"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseTransport

type BaseTransport struct {
	// contains filtered or unexported fields
}

BaseTransport is a wrapper around http.Transport with some BaseTransportConfig configuration.

func NewBaseTransport

func NewBaseTransport() *BaseTransport

NewBaseTransport returns a BaseTransport instance with optimized default BaseTransportConfig configuration.

func NewBaseTransportWithConfig

func NewBaseTransportWithConfig(config *BaseTransportConfig) *BaseTransport

NewBaseTransportWithConfig returns a BaseTransport instance for a provided BaseTransportConfig configuration.

func (*BaseTransport) Base

func (t *BaseTransport) Base() *http.Transport

Base returns the wrapped http.Transport.

func (*BaseTransport) RoundTrip

func (t *BaseTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip performs a request / response round trip, based on the wrapped http.Transport.

type BaseTransportConfig

type BaseTransportConfig struct {
	MaxIdleConnections        int
	MaxConnectionsPerHost     int
	MaxIdleConnectionsPerHost int
}

BaseTransportConfig is the configuration of the BaseTransport.

type LoggerTransport

type LoggerTransport struct {
	// contains filtered or unexported fields
}

LoggerTransport is a wrapper around http.RoundTripper with some LoggerTransportConfig configuration.

func NewLoggerTransport

func NewLoggerTransport(base http.RoundTripper) *LoggerTransport

NewLoggerTransport returns a LoggerTransport instance with default LoggerTransportConfig configuration.

func NewLoggerTransportWithConfig

func NewLoggerTransportWithConfig(base http.RoundTripper, config *LoggerTransportConfig) *LoggerTransport

NewLoggerTransportWithConfig returns a LoggerTransport instance for a provided LoggerTransportConfig configuration.

func (*LoggerTransport) Base

func (t *LoggerTransport) Base() http.RoundTripper

Base returns the wrapped http.RoundTripper.

func (*LoggerTransport) RoundTrip

func (t *LoggerTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip performs a request / response round trip, based on the wrapped http.RoundTripper.

type LoggerTransportConfig

type LoggerTransportConfig struct {
	LogRequest                       bool
	LogResponse                      bool
	LogRequestBody                   bool
	LogResponseBody                  bool
	LogRequestLevel                  zerolog.Level
	LogResponseLevel                 zerolog.Level
	LogResponseLevelFromResponseCode bool
}

LoggerTransportConfig is the configuration of the LoggerTransport.

type MetricsTransport added in v1.1.0

type MetricsTransport struct {
	// contains filtered or unexported fields
}

MetricsTransport is a wrapper around http.RoundTripper with some MetricsTransportConfig configuration.

func NewMetricsTransport added in v1.1.0

func NewMetricsTransport(base http.RoundTripper) *MetricsTransport

NewMetricsTransport returns a MetricsTransport instance with default MetricsTransportConfig configuration.

func NewMetricsTransportWithConfig added in v1.1.0

func NewMetricsTransportWithConfig(base http.RoundTripper, config *MetricsTransportConfig) *MetricsTransport

NewMetricsTransportWithConfig returns a MetricsTransport instance for a provided MetricsTransportConfig configuration.

func (*MetricsTransport) Base added in v1.1.0

Base returns the wrapped http.RoundTripper.

func (*MetricsTransport) RoundTrip added in v1.1.0

func (t *MetricsTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip performs a request / response round trip, based on the wrapped http.RoundTripper.

type MetricsTransportConfig added in v1.1.0

type MetricsTransportConfig struct {
	Registry                  prometheus.Registerer
	Namespace                 string
	Subsystem                 string
	Buckets                   []float64
	NormalizeRequestPath      bool
	NormalizeRequestPathMasks map[string]string
	NormalizeResponseStatus   bool
}

MetricsTransportConfig is the configuration of the MetricsTransport.

Jump to

Keyboard shortcuts

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