Retry middleware improvements #682
Labels
A-retry
Area: The tower "retry" middleware
C-enhancement
Category: A PR with an enhancement or a proposed on in an issue.
E-help-wanted
Call for participation: Help is requested to fix this issue.
E-medium
Call for participation: Experience needed to fix: Medium / intermediate
P-high
High priority
This issue scopes out the changes we are proposing to the retry middleware to improve its ergonomics. Currently, the retry middleware is quite hard to use and requires implementing a custom
Policy
. Writing this policy is non-trivial and is more work than it should be.These improvements are aimed at setting up retries with tower to be easier and more user friendly. As well as providing good defaults that work out of the box.
List of improvements to
tower
andtower-http
:Policy
(retry: ChangePolicy
to accept&mut self
#681).&mut self
.Future
output to()
.Policy
to be object safe.trait Backoff
that has an associated future type that allows others to use this utility without being tied totokio::time
.ExponentialBackoff
type that implementsBackoff
, ported fromlinkerd2-proxy
.Rng
utilities util: Addrng
utilities #686retry budget
#613).Budget
trait to allow users to choose which implementation to use.StandardRetryPolicy
andstandard_policy
mod #698StandardRetryPolicy
combiningimpl Backoff
andimpl Budget
.StandardRetryPolicyBuilder
that accept closures (?) foris_retryable(&mut Req, &mut Result<Res, E>) -> bool
and aclone_request(&Req) -> Option<Req>
.tower-http
improvements.retry
moduleReplayBody
similar to the one implemented inlinkerd2-proxy
.HttpRetry
layer that accepts higher level constructs for retrying, likeClassifyResponse
, and will wrap http request bodies withReplayBody
.tower
andtower-http
.tower
andtower-http
.Example code
tower
examples with nohttp
:tower-http
examples:cc @rcoh @hawkw @jonhoo @seanmonstar @davidpdrsn
The text was updated successfully, but these errors were encountered: