retry

package
v2.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Enabled:         true,
	InitialInterval: 5 * time.Second,
	MaxInterval:     30 * time.Second,
	MaxElapsedTime:  time.Minute,
}

DefaultConfig are the recommended defaults to use.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Enabled indicates whether to not retry sending batches in case of
	// export failure.
	Enabled bool
	// InitialInterval the time to wait after the first failure before
	// retrying.
	InitialInterval time.Duration
	// MaxInterval is the upper bound on backoff interval. Once this value is
	// reached the delay between consecutive retries will always be
	// `MaxInterval`.
	MaxInterval time.Duration
	// MaxElapsedTime is the maximum amount of time (including retries) spent
	// trying to send a request/batch.  Once this value is reached, the data
	// is discarded.
	MaxElapsedTime time.Duration
}

Config defines configuration for retrying batches in case of export failure using an exponential backoff.

func (Config) RequestFunc

func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc

type EvaluateFunc

type EvaluateFunc func(error) (bool, time.Duration)

EvaluateFunc returns if an error is retry-able and if an explicit throttle duration should be honored that was included in the error.

type RequestFunc

type RequestFunc func(context.Context, func(context.Context) error) error

RequestFunc wraps a request with retry logic.

Jump to

Keyboard shortcuts

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