pub struct LatencyProfile {
pub base_ms: u64,
pub jitter_ms: u64,
pub distribution: LatencyDistribution,
pub std_dev_ms: Option<f64>,
pub pareto_shape: Option<f64>,
pub min_ms: u64,
pub max_ms: Option<u64>,
pub tag_overrides: HashMap<String, u64>,
}
Expand description
Latency profile configuration
Fields§
§base_ms: u64
Base latency in milliseconds (mean for distributions)
jitter_ms: u64
Random jitter range in milliseconds (for fixed distribution)
distribution: LatencyDistribution
Distribution type for latency variation
std_dev_ms: Option<f64>
Standard deviation for normal distribution (in milliseconds)
pareto_shape: Option<f64>
Shape parameter for pareto distribution (alpha > 0)
min_ms: u64
Minimum latency bound (prevents negative values)
max_ms: Option<u64>
Maximum latency bound (prevents extreme values)
tag_overrides: HashMap<String, u64>
Tag-based latency overrides
Implementations§
Source§impl LatencyProfile
impl LatencyProfile
Sourcepub fn new(base_ms: u64, jitter_ms: u64) -> Self
pub fn new(base_ms: u64, jitter_ms: u64) -> Self
Create a new latency profile with fixed distribution (backward compatible)
Sourcepub fn with_normal_distribution(base_ms: u64, std_dev_ms: f64) -> Self
pub fn with_normal_distribution(base_ms: u64, std_dev_ms: f64) -> Self
Create a new latency profile with normal distribution
Sourcepub fn with_pareto_distribution(base_ms: u64, shape: f64) -> Self
pub fn with_pareto_distribution(base_ms: u64, shape: f64) -> Self
Create a new latency profile with pareto distribution
Sourcepub fn with_tag_override(self, tag: String, latency_ms: u64) -> Self
pub fn with_tag_override(self, tag: String, latency_ms: u64) -> Self
Add a tag-based latency override
Sourcepub fn with_min_ms(self, min_ms: u64) -> Self
pub fn with_min_ms(self, min_ms: u64) -> Self
Set minimum latency bound
Sourcepub fn with_max_ms(self, max_ms: u64) -> Self
pub fn with_max_ms(self, max_ms: u64) -> Self
Set maximum latency bound
Sourcepub fn calculate_latency(&self, tags: &[String]) -> Duration
pub fn calculate_latency(&self, tags: &[String]) -> Duration
Calculate latency for a request with optional tags
Trait Implementations§
Source§impl Clone for LatencyProfile
impl Clone for LatencyProfile
Source§fn clone(&self) -> LatencyProfile
fn clone(&self) -> LatencyProfile
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 LatencyProfile
impl Debug for LatencyProfile
Source§impl Default for LatencyProfile
impl Default for LatencyProfile
Source§impl<'de> Deserialize<'de> for LatencyProfile
impl<'de> Deserialize<'de> for LatencyProfile
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 LatencyProfile
impl RefUnwindSafe for LatencyProfile
impl Send for LatencyProfile
impl Sync for LatencyProfile
impl Unpin for LatencyProfile
impl UnwindSafe for LatencyProfile
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