ReadonlyattemptsAttempts that may be in flight at once. 1 hedges nothing.
Optional ReadonlybudgetA ceiling on the extra attempts, shared with whatever else draws on it.
A hedge sends a second request exactly when the dependency is slow, which is exactly when it can least afford the traffic. Sharing one budget with the retry above means the two cannot quietly add up to three times the load. The hedge only spends: the call is recorded once, by the retry.
Optional ReadonlyclockDefaults to the system clock.
ReadonlydelayHow long to wait for the attempt in flight before starting another, as a number or as a schedule read with the number of attempts already started.
Set it near the latency you are willing to accept (around the p95 of the call, not the p50), or every call is sent twice.
Optional ReadonlyonReceives a hedge event per attempt started beyond the first.
Optional ReadonlyshouldWhich failures start the next attempt immediately rather than waiting out the delay.
Left out, a hedge answers latency only: a failure is passed straight to
the caller and repeating it is retry's job. Supplying this makes the
hedge repeat failures too, which is a decision with the same shape as
shouldRetry and is why it has no default.
Configuration for hedge.