package retry
import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry"
Package retry provides request retry functionality that can perform configurable exponential backoff for transient errors and honor any explicit throttle responses received.
Index ¶
Variables ¶
var DefaultConfig = Config{ Enabled: true, InitialInterval: 5 * time.Second, MaxInterval: 30 * time.Second, MaxElapsedTime: time.Minute, }
DefaultConfig are the recommended defaults to use.
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
RequestFunc returns a RequestFunc using the evaluate function to determine if requests can be retried and based on the exponential backoff configuration of c.
type EvaluateFunc ¶
EvaluateFunc returns if an error is retry-able and if an explicit throttle duration should be honored that was included in the error.
The function must return true if the error argument is retry-able, otherwise it must return false for the first return parameter.
The function must return a non-zero time.Duration if the error contains explicit throttle duration that should be honored, otherwise it must return a zero valued time.Duration.
type RequestFunc ¶
RequestFunc wraps a request with retry logic.
Source Files ¶
retry.go
- Version
- v1.37.0 (latest)
- Published
- Jun 25, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 10 months ago –
Tools for package owners.