http

package
v0.8.18 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBackoff = Backoff{1.0 * time.Second, 2.0, 0.1}
View Source
var DefaultRetry = Retry{3 * time.Second, 3}

Functions

func NewRetryTransport added in v0.7.135

func NewRetryTransport(base http.RoundTripper) http.RoundTripper

NewRetryTransport creates a custom HTTP transport that handles 429, 408, and 503 errors with exponential backoff. It wraps the provided transport and adds retry logic specifically for rate limiting, timeout, and service unavailable scenarios.

func NewRetryTransportWithConfig added in v0.7.135

func NewRetryTransportWithConfig(base http.RoundTripper, retry Retry, backoff Backoff) http.RoundTripper

NewRetryTransportWithConfig creates a retry transport with custom retry and backoff settings

func NewTracingRoundTripper

func NewTracingRoundTripper(transport http.RoundTripper) http.RoundTripper

func NewTracingRoundTripperWithLogger

func NewTracingRoundTripperWithLogger(transport http.RoundTripper) http.RoundTripper

func SetRetryConfig added in v0.7.135

func SetRetryConfig(config RetryConfig)

SetRetryConfig updates the retry configuration

Types

type Backoff

type Backoff struct {
	Duration time.Duration
	Factor   float64
	Jitter   float64
}

type Retry

type Retry struct {
	MaxWait  time.Duration
	MaxRetry int
}

type RetryConfig added in v0.7.135

type RetryConfig struct {
	MaxWait  time.Duration
	MaxRetry int
	Duration time.Duration
	Factor   float64
	Jitter   float64
}

RetryConfig holds the configuration for retry behavior

func GetRetryConfig added in v0.7.135

func GetRetryConfig() RetryConfig

GetRetryConfig returns the current retry configuration

Jump to

Keyboard shortcuts

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