pub struct ChaosConfig {
pub enabled: bool,
pub error_rate: f64,
pub delay_rate: f64,
pub min_delay_ms: u64,
pub max_delay_ms: u64,
pub status_codes: Vec<u16>,
pub inject_timeouts: bool,
pub timeout_ms: u64,
}
Expand description
Chaos mode configuration
Fields§
§enabled: bool
Enable chaos mode
error_rate: f64
Error injection rate (0.0 to 1.0)
delay_rate: f64
Delay injection rate (0.0 to 1.0)
min_delay_ms: u64
Minimum delay in milliseconds
max_delay_ms: u64
Maximum delay in milliseconds
status_codes: Vec<u16>
Status codes to randomly inject
inject_timeouts: bool
Whether to inject random timeouts
timeout_ms: u64
Timeout duration in milliseconds
Implementations§
Source§impl ChaosConfig
impl ChaosConfig
Sourcepub fn new(error_rate: f64, delay_rate: f64) -> Self
pub fn new(error_rate: f64, delay_rate: f64) -> Self
Create a new chaos config with custom error and delay rates
Sourcepub fn with_delay_range(self, min_ms: u64, max_ms: u64) -> Self
pub fn with_delay_range(self, min_ms: u64, max_ms: u64) -> Self
Configure the delay range
Sourcepub fn with_status_codes(self, codes: Vec<u16>) -> Self
pub fn with_status_codes(self, codes: Vec<u16>) -> Self
Configure status codes to inject
Sourcepub fn with_timeouts(self, timeout_ms: u64) -> Self
pub fn with_timeouts(self, timeout_ms: u64) -> Self
Enable timeout injection
Trait Implementations§
Source§impl Clone for ChaosConfig
impl Clone for ChaosConfig
Source§fn clone(&self) -> ChaosConfig
fn clone(&self) -> ChaosConfig
Returns a duplicate of the value. Read more
1.0.0 · 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 ChaosConfig
impl Debug for ChaosConfig
Source§impl Default for ChaosConfig
impl Default for ChaosConfig
Source§impl<'de> Deserialize<'de> for ChaosConfig
impl<'de> Deserialize<'de> for ChaosConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ChaosConfig
impl RefUnwindSafe for ChaosConfig
impl Send for ChaosConfig
impl Sync for ChaosConfig
impl Unpin for ChaosConfig
impl UnwindSafe for ChaosConfig
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