pub struct RuleMetrics {
pub rule_name: String,
pub total_evaluations: u64,
pub total_fires: u64,
pub total_successes: u64,
pub total_failures: u64,
pub total_execution_time: Duration,
pub min_execution_time: Duration,
pub max_execution_time: Duration,
pub estimated_memory_usage: usize,
pub last_executed: Option<SystemTime>,
pub recent_execution_times: Vec<Duration>,
}Expand description
Individual rule execution metrics
Fields§
§rule_name: StringName of the rule
total_evaluations: u64Total number of times this rule was evaluated
total_fires: u64Total number of times this rule fired (condition was true)
total_successes: u64Total number of successful executions (no errors)
total_failures: u64Total number of failed executions (with errors)
total_execution_time: DurationSum of all execution times for averaging
min_execution_time: DurationFastest execution time recorded
max_execution_time: DurationSlowest execution time recorded
estimated_memory_usage: usizeEstimated memory usage for this rule
last_executed: Option<SystemTime>Last time this rule was executed
recent_execution_times: Vec<Duration>Recent execution times (for trend analysis)
Implementations§
Source§impl RuleMetrics
impl RuleMetrics
Sourcepub fn record_execution(
&mut self,
duration: Duration,
fired: bool,
memory_usage: usize,
)
pub fn record_execution( &mut self, duration: Duration, fired: bool, memory_usage: usize, )
Record a successful rule execution
Sourcepub fn record_failure(&mut self, duration: Duration)
pub fn record_failure(&mut self, duration: Duration)
Record a failed rule execution
Sourcepub fn avg_execution_time(&self) -> Duration
pub fn avg_execution_time(&self) -> Duration
Calculate average execution time
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Calculate success rate as percentage
Sourcepub fn is_problematic(&self) -> bool
pub fn is_problematic(&self) -> bool
Check if this rule is performing poorly
Trait Implementations§
Source§impl Clone for RuleMetrics
impl Clone for RuleMetrics
Source§fn clone(&self) -> RuleMetrics
fn clone(&self) -> RuleMetrics
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 RuleMetrics
impl Debug for RuleMetrics
Source§impl<'de> Deserialize<'de> for RuleMetrics
impl<'de> Deserialize<'de> for RuleMetrics
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 RuleMetrics
impl RefUnwindSafe for RuleMetrics
impl Send for RuleMetrics
impl Sync for RuleMetrics
impl Unpin for RuleMetrics
impl UnwindSafe for RuleMetrics
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