diff --git a/src/sinks/util/retries.rs b/src/sinks/util/retries.rs index cccfbd744494f..003f1990b53f9 100644 --- a/src/sinks/util/retries.rs +++ b/src/sinks/util/retries.rs @@ -27,8 +27,16 @@ pub trait RetryLogic: Clone + Send + Sync + 'static { type Error: std::error::Error + Send + Sync + 'static; type Response; + /// When the Service call returns an `Err` response, this function allows + /// implementors to specify what kinds of errors can be retried. fn is_retriable_error(&self, error: &Self::Error) -> bool; + /// When the Service call returns an `Ok` response, this function allows + /// implementors to specify additional logic to determine if the success response + /// is actually an error. This is particularly useful when the downstream service + /// of a sink returns a transport protocol layer success but error data in the + /// response body. For example, an HTTP 200 status, but the body of the response + /// contains a list of errors encountered while processing. fn should_retry_response(&self, _response: &Self::Response) -> RetryAction { // Treat the default as the request is successful RetryAction::Successful