pub struct ErrorStatistics {
pub total_errors: u64,
pub errors_by_category: HashMap<ErrorHandlingCategory, u64>,
pub errors_by_code: HashMap<LarkErrorCode, u64>,
pub errors_by_severity: HashMap<ErrorSeverity, u64>,
pub retryable_errors: u64,
pub average_processing_time: Option<Duration>,
pub first_error_time: Option<SystemTime>,
pub last_error_time: Option<SystemTime>,
}Expand description
错误统计数据
Fields§
§total_errors: u64总错误数
errors_by_category: HashMap<ErrorHandlingCategory, u64>按类别分组的错误数
errors_by_code: HashMap<LarkErrorCode, u64>按错误码分组的错误数
errors_by_severity: HashMap<ErrorSeverity, u64>按严重级别分组的错误数
retryable_errors: u64可重试错误数
average_processing_time: Option<Duration>平均处理时间
first_error_time: Option<SystemTime>第一个错误时间
last_error_time: Option<SystemTime>最后一个错误时间
Implementations§
Source§impl ErrorStatistics
impl ErrorStatistics
Sourcepub fn error_rate_per_minute(&self) -> f64
pub fn error_rate_per_minute(&self) -> f64
计算错误率(每分钟)
Sourcepub fn most_common_category(&self) -> Option<ErrorHandlingCategory>
pub fn most_common_category(&self) -> Option<ErrorHandlingCategory>
获取最常见的错误类别
Sourcepub fn highest_severity(&self) -> Option<ErrorSeverity>
pub fn highest_severity(&self) -> Option<ErrorSeverity>
获取最严重的错误级别
Sourcepub fn retryable_percentage(&self) -> f64
pub fn retryable_percentage(&self) -> f64
计算可重试错误百分比
Sourcepub fn print_summary(&self)
pub fn print_summary(&self)
打印统计摘要
Sourcepub fn print_detailed(&self)
pub fn print_detailed(&self)
打印详细统计
Trait Implementations§
Source§impl Clone for ErrorStatistics
impl Clone for ErrorStatistics
Source§fn clone(&self) -> ErrorStatistics
fn clone(&self) -> ErrorStatistics
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ErrorStatistics
impl Debug for ErrorStatistics
Source§impl Default for ErrorStatistics
impl Default for ErrorStatistics
Source§fn default() -> ErrorStatistics
fn default() -> ErrorStatistics
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ErrorStatistics
impl RefUnwindSafe for ErrorStatistics
impl Send for ErrorStatistics
impl Sync for ErrorStatistics
impl Unpin for ErrorStatistics
impl UnwindSafe for ErrorStatistics
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