#[non_exhaustive]pub struct HedgingOptions { /* private fields */ }Expand description
Configure publisher request hedging behavior.
Request hedging sends a duplicate publish request when an in-flight batch publish RPC exceeds a configured delay threshold, mitigating tail latency caused by slow backend tasks or transient network stalls.
Hedging uses a token bucket to rate-limit hedged RPCs. Successful publish RPCs refill fractional tokens, and sending a hedged RPC decrements 1 token.
Request hedging is only active for messages published without an ordering key. For ordered publishing (messages with an ordering key), hedging is disabled to preserve strict ordering guarantees.
Implementations§
Source§impl HedgingOptions
impl HedgingOptions
Sourcepub fn set_delay<V: Into<Duration>>(self, v: V) -> Self
pub fn set_delay<V: Into<Duration>>(self, v: V) -> Self
Set the delay before sending a hedged request.
Clamped between 100ms and 10s.
Sourcepub fn set_max_tokens<V: Into<u32>>(self, v: V) -> Self
pub fn set_max_tokens<V: Into<u32>>(self, v: V) -> Self
Set the maximum number of tokens in the token bucket.
Clamped between 1 and 250.
Sourcepub fn set_refill_ratio<V: Into<f32>>(self, v: V) -> Self
pub fn set_refill_ratio<V: Into<f32>>(self, v: V) -> Self
Set the fraction of a token refilled per successful publish RPC.
Clamped between 0.001 and 0.2.
Trait Implementations§
Source§impl Clone for HedgingOptions
impl Clone for HedgingOptions
Source§impl Debug for HedgingOptions
impl Debug for HedgingOptions
Source§impl Default for HedgingOptions
impl Default for HedgingOptions
Source§impl PartialEq for HedgingOptions
impl PartialEq for HedgingOptions
impl StructuralPartialEq for HedgingOptions
Auto Trait Implementations§
impl Freeze for HedgingOptions
impl RefUnwindSafe for HedgingOptions
impl Send for HedgingOptions
impl Sync for HedgingOptions
impl Unpin for HedgingOptions
impl UnsafeUnpin for HedgingOptions
impl UnwindSafe for HedgingOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> 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