gentlemanretry

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(options ...Option) plugin.Plugin

Middleware returns a gentleman plugin implementing retry logic for http requests implementing http round tripper interface.

Types

type Option

type Option func(*transport)

func BackoffTimeout

func BackoffTimeout(timeout time.Duration) Option

BackoffTimeout returns an option setting the transports backoff timeout between retries to the given duration.

func Evaluator

func Evaluator(evalFn evalFunc) Option

Evaluator returns an option containing an evaluator function capable of deciding whether a new retry is needed.

If not set the defaultEvaluator will be used. If the request has resulted in an error, or the request status code indicates a server problem, or the request timed out, the default evaluator returns that a retry is needed.

func LogRequest

func LogRequest() Option

LogRequest returns an option which will enable the logging of requests using httputil.DumpResponse.

func LogResponse

func LogResponse() Option

LogResponse returns an option which will enable the logging of responses using httputil.DumpResponse.

func Logger

func Logger(logger retry.Logger) Option

Logger enables logging and adds a logger interface to the transport struct.

func RequestTimeout

func RequestTimeout(timeout time.Duration) Option

RequestTimeout returns an option setting the transport request timeout to the given duration.

If the original request had a deadline, than it will be used mainly. Without a deadline on the original request the given timeout is set per retry for the request.

func Tracer added in v1.4.0

func Tracer(tracer opentracing.Tracer) Option

Tracer enables tracing and span creation on every retry.

Jump to

Keyboard shortcuts

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