pub struct RestResilienceConfig {Show 16 fields
pub breaker_enabled: bool,
pub breaker_failure_threshold: u32,
pub breaker_reset_timeout: Duration,
pub breaker_sre_enabled: bool,
pub breaker_sre_k_millis: u32,
pub breaker_sre_protection: u64,
pub max_concurrency: Option<usize>,
pub request_timeout: Option<Duration>,
pub shedding_enabled: bool,
pub shedding_max_in_flight: Option<usize>,
pub shedding_min_request_count: u64,
pub shedding_max_latency: Duration,
pub shedding_cpu_threshold_millis: u32,
pub shedding_cool_off: Duration,
pub shedding_window_buckets: usize,
pub shedding_window_bucket_duration: Duration,
}Expand description
REST resilience middleware configuration.
Fields§
§breaker_enabled: boolWhether route-level circuit breaking is enabled.
breaker_failure_threshold: u32Consecutive failures that open a route breaker.
breaker_reset_timeout: DurationTime before an open breaker allows a half-open trial call.
breaker_sre_enabled: boolWhether the route breaker uses Google SRE style adaptive rejection.
breaker_sre_k_millis: u32SRE breaker multiplier in millis. 1500 means k = 1.5.
breaker_sre_protection: u64Minimum total samples before SRE breaker rejection can start.
max_concurrency: Option<usize>Optional maximum number of in-flight requests.
request_timeout: Option<Duration>Optional timeout overriding RestConfig::timeout for the default stack.
shedding_enabled: boolWhether adaptive request shedding is enabled.
shedding_max_in_flight: Option<usize>Maximum in-flight requests used by the adaptive shedder.
shedding_min_request_count: u64Minimum request samples before latency-based shedding can reject.
shedding_max_latency: DurationAverage latency threshold used by adaptive shedding.
shedding_cpu_threshold_millis: u32CPU usage threshold used by adaptive shedding, where 1000 means 100%.
shedding_cool_off: DurationCool-off duration after a recent adaptive shedder drop.
shedding_window_buckets: usizeNumber of buckets used by adaptive shedder rolling windows.
shedding_window_bucket_duration: DurationDuration represented by each adaptive shedder bucket.
Implementations§
Source§impl RestResilienceConfig
impl RestResilienceConfig
Sourcepub fn production_defaults() -> Self
pub fn production_defaults() -> Self
Returns a production-oriented resilience profile for production services.
Sourcepub fn go_zero_defaults() -> Self
👎Deprecated: use production_defaults instead
pub fn go_zero_defaults() -> Self
use production_defaults instead
Returns a production-oriented resilience profile.
Trait Implementations§
Source§impl Clone for RestResilienceConfig
impl Clone for RestResilienceConfig
Source§fn clone(&self) -> RestResilienceConfig
fn clone(&self) -> RestResilienceConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RestResilienceConfig
impl Debug for RestResilienceConfig
Source§impl Default for RestResilienceConfig
impl Default for RestResilienceConfig
Source§impl PartialEq for RestResilienceConfig
impl PartialEq for RestResilienceConfig
Source§fn eq(&self, other: &RestResilienceConfig) -> bool
fn eq(&self, other: &RestResilienceConfig) -> bool
self and other values to be equal, and is used by ==.impl Eq for RestResilienceConfig
impl StructuralPartialEq for RestResilienceConfig
Auto Trait Implementations§
impl Freeze for RestResilienceConfig
impl RefUnwindSafe for RestResilienceConfig
impl Send for RestResilienceConfig
impl Sync for RestResilienceConfig
impl Unpin for RestResilienceConfig
impl UnsafeUnpin for RestResilienceConfig
impl UnwindSafe for RestResilienceConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request