pub struct MetricsManager { /* private fields */ }
Expand description
高性能指标管理器
Implementations§
Source§impl MetricsManager
impl MetricsManager
Sourcepub fn record_process(&self, event_type: EventType)
pub fn record_process(&self, event_type: EventType)
记录处理次数(非阻塞)
Sourcepub fn record_events(
&self,
event_type: EventType,
count: u64,
processing_time_us: f64,
)
pub fn record_events( &self, event_type: EventType, count: u64, processing_time_us: f64, )
记录事件处理(非阻塞)
Sourcepub fn log_slow_processing(&self, processing_time_us: f64, event_count: usize)
pub fn log_slow_processing(&self, processing_time_us: f64, event_count: usize)
记录慢处理操作
Sourcepub fn get_uptime(&self) -> Duration
pub fn get_uptime(&self) -> Duration
获取运行时长
Sourcepub fn get_event_metrics(&self, event_type: EventType) -> EventMetricsSnapshot
pub fn get_event_metrics(&self, event_type: EventType) -> EventMetricsSnapshot
获取事件指标
Sourcepub fn get_processing_stats(&self) -> ProcessingTimeStats
pub fn get_processing_stats(&self) -> ProcessingTimeStats
获取处理时间统计
Sourcepub fn get_dropped_events_count(&self) -> u64
pub fn get_dropped_events_count(&self) -> u64
获取丢弃事件计数
Sourcepub fn print_metrics(&self)
pub fn print_metrics(&self)
打印性能指标(非阻塞)
Sourcepub async fn start_auto_monitoring(&self) -> Option<JoinHandle<()>>
pub async fn start_auto_monitoring(&self) -> Option<JoinHandle<()>>
启动自动性能监控任务
Sourcepub fn new_with_metrics(
_metrics: Arc<RwLock<PerformanceMetrics>>,
enable_metrics: bool,
stream_name: String,
) -> Self
pub fn new_with_metrics( _metrics: Arc<RwLock<PerformanceMetrics>>, enable_metrics: bool, stream_name: String, ) -> Self
兼容性构造函数
Sourcepub fn get_metrics(&self) -> PerformanceMetrics
pub fn get_metrics(&self) -> PerformanceMetrics
获取完整的性能指标(兼容性方法)
Sourcepub fn add_tx_process_count(&self)
pub fn add_tx_process_count(&self)
兼容性方法 - 添加交易处理计数
Sourcepub fn add_account_process_count(&self)
pub fn add_account_process_count(&self)
兼容性方法 - 添加账户处理计数
Sourcepub fn add_block_meta_process_count(&self)
pub fn add_block_meta_process_count(&self)
兼容性方法 - 添加区块元数据处理计数
Sourcepub fn update_metrics(
&self,
event_type: MetricsEventType,
events_processed: u64,
processing_time_us: f64,
)
pub fn update_metrics( &self, event_type: MetricsEventType, events_processed: u64, processing_time_us: f64, )
兼容性方法 - 更新指标
Sourcepub fn increment_dropped_events(&self)
pub fn increment_dropped_events(&self)
增加丢弃事件计数
Sourcepub fn increment_dropped_events_by(&self, count: u64)
pub fn increment_dropped_events_by(&self, count: u64)
批量增加丢弃事件计数
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MetricsManager
impl RefUnwindSafe for MetricsManager
impl Send for MetricsManager
impl Sync for MetricsManager
impl Unpin for MetricsManager
impl UnwindSafe for MetricsManager
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request