pub struct ShadowConfig {
pub shadow_timeout: Duration,
pub ignore: Vec<IgnoreField>,
/* private fields */
}Expand description
Knobs the shadower needs.
Fields§
§shadow_timeout: DurationMax time the shadow leg is allowed. After this we drop it and flag a
ShadowTimeout on the outcome — never blocks the primary.
ignore: Vec<IgnoreField>Fields to skip in the divergence check.
Implementations§
Source§impl ShadowConfig
impl ShadowConfig
Sourcepub fn full_sample() -> Self
pub fn full_sample() -> Self
Mirror every request, default timeout 2s.
Sourcepub fn sample_rate(self, percent: u32) -> Self
pub fn sample_rate(self, percent: u32) -> Self
Set sampling rate as a percentage (0..=100). Values >100 are clamped.
Sourcepub fn shadow_timeout(self, d: Duration) -> Self
pub fn shadow_timeout(self, d: Duration) -> Self
Override the shadow timeout.
Sourcepub fn ignore(self, field: IgnoreField) -> Self
pub fn ignore(self, field: IgnoreField) -> Self
Add a field to skip in the divergence diff.
Sourcepub fn sample_rate_percent(&self) -> u32
pub fn sample_rate_percent(&self) -> u32
Configured sample rate (0..=100).
Sourcepub fn should_shadow(&self, key: &[u8]) -> bool
pub fn should_shadow(&self, key: &[u8]) -> bool
Decide whether this request should be mirrored. Bucketing is sticky on
the key — the same key always gets the same yes/no for a given
sample_rate. SHA-256 (mod 100) is cheap and avoids an RNG dep.
Trait Implementations§
Source§impl Clone for ShadowConfig
impl Clone for ShadowConfig
Source§fn clone(&self) -> ShadowConfig
fn clone(&self) -> ShadowConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ShadowConfig
impl Debug for ShadowConfig
Auto Trait Implementations§
impl Freeze for ShadowConfig
impl RefUnwindSafe for ShadowConfig
impl Send for ShadowConfig
impl Sync for ShadowConfig
impl Unpin for ShadowConfig
impl UnsafeUnpin for ShadowConfig
impl UnwindSafe for ShadowConfig
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
Mutably borrows from an owned value. Read more