pub struct RuleAnalytics { /* private fields */ }Expand description
Main analytics collector and analyzer
Implementations§
Source§impl RuleAnalytics
impl RuleAnalytics
Sourcepub fn new(config: AnalyticsConfig) -> Self
pub fn new(config: AnalyticsConfig) -> Self
Create new analytics collector
Sourcepub fn record_execution(
&mut self,
rule_name: &str,
duration: Duration,
fired: bool,
success: bool,
error: Option<String>,
memory_usage: usize,
)
pub fn record_execution( &mut self, rule_name: &str, duration: Duration, fired: bool, success: bool, error: Option<String>, memory_usage: usize, )
Record a rule execution
Sourcepub fn get_rule_metrics(&self, rule_name: &str) -> Option<&RuleMetrics>
pub fn get_rule_metrics(&self, rule_name: &str) -> Option<&RuleMetrics>
Get metrics for a specific rule
Sourcepub fn get_all_metrics(&self) -> &HashMap<String, RuleMetrics>
pub fn get_all_metrics(&self) -> &HashMap<String, RuleMetrics>
Get all rule metrics
Sourcepub fn slowest_rules(&self, limit: usize) -> Vec<&RuleMetrics>
pub fn slowest_rules(&self, limit: usize) -> Vec<&RuleMetrics>
Get the slowest rules
Sourcepub fn most_fired_rules(&self, limit: usize) -> Vec<&RuleMetrics>
pub fn most_fired_rules(&self, limit: usize) -> Vec<&RuleMetrics>
Get the most frequently fired rules
Sourcepub fn problematic_rules(&self) -> Vec<&RuleMetrics>
pub fn problematic_rules(&self) -> Vec<&RuleMetrics>
Get problematic rules (low success rate, high execution time, etc.)
Sourcepub fn overall_stats(&self) -> OverallStats
pub fn overall_stats(&self) -> OverallStats
Calculate overall performance statistics
Sourcepub fn config(&self) -> &AnalyticsConfig
pub fn config(&self) -> &AnalyticsConfig
Get configuration reference
Sourcepub fn get_all_rule_metrics(&self) -> &HashMap<String, RuleMetrics>
pub fn get_all_rule_metrics(&self) -> &HashMap<String, RuleMetrics>
Get all rule metrics as a map
Sourcepub fn generate_recommendations(&self) -> Vec<String>
pub fn generate_recommendations(&self) -> Vec<String>
Generate optimization recommendations based on analytics data
Sourcepub fn get_recent_events(&self, limit: usize) -> Vec<&ExecutionEvent>
pub fn get_recent_events(&self, limit: usize) -> Vec<&ExecutionEvent>
Get recent execution events
Sourcepub fn get_overall_stats(&self) -> OverallStats
pub fn get_overall_stats(&self) -> OverallStats
Get overall performance statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RuleAnalytics
impl RefUnwindSafe for RuleAnalytics
impl Send for RuleAnalytics
impl Sync for RuleAnalytics
impl Unpin for RuleAnalytics
impl UnwindSafe for RuleAnalytics
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