hedging

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTooManyHedgeRequests = errors.New("too many hedge requests")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// At is the duration after which a second request will be issued.
	At time.Duration `yaml:"at"`
	// UpTo is the maximum number of requests that will be issued.
	UpTo int `yaml:"up_to"`
	// The maximun of hedge requests allowed per second.
	MaxPerSecond int `yaml:"max_per_second"`
}

Config is the configuration for hedging requests.

func (*Config) Client

func (cfg *Config) Client(client *http.Client) (*http.Client, error)

Client returns a hedged http client. The client transport will be mutated to use the hedged roundtripper.

func (*Config) ClientWithRegisterer

func (cfg *Config) ClientWithRegisterer(client *http.Client, reg prometheus.Registerer) (*http.Client, error)

ClientWithRegisterer returns a hedged http client with instrumentation registered to the provided registerer. The client transport will be mutated to use the hedged roundtripper.

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers flags.

func (*Config) RegisterFlagsWithPrefix

func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlagsWithPrefix registers flags with prefix.

func (*Config) RoundTripper

func (cfg *Config) RoundTripper(next http.RoundTripper) (http.RoundTripper, error)

RoundTripper returns a hedged roundtripper.

func (*Config) RoundTripperWithRegisterer

func (cfg *Config) RoundTripperWithRegisterer(next http.RoundTripper, reg prometheus.Registerer) (http.RoundTripper, error)

RoundTripperWithRegisterer returns a hedged roundtripper with instrumentation registered to the provided registerer.

Jump to

Keyboard shortcuts

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