pub struct MetricsCollector { /* private fields */ }Expand description
Main metrics collector
Implementations§
Source§impl MetricsCollector
impl MetricsCollector
Sourcepub fn new(config: &ObservabilityConfig) -> Result<Self>
pub fn new(config: &ObservabilityConfig) -> Result<Self>
Create a new metrics collector
Sourcepub async fn initialize(&self) -> Result<()>
pub async fn initialize(&self) -> Result<()>
Initialize the metrics collector
Sourcepub fn start_timer(
&self,
operation: &str,
labels: MetricLabels,
) -> OperationTimer
pub fn start_timer( &self, operation: &str, labels: MetricLabels, ) -> OperationTimer
Start a timer for an operation
Sourcepub fn increment_counter(&self, name: &str, labels: MetricLabels)
pub fn increment_counter(&self, name: &str, labels: MetricLabels)
Record a counter metric
Sourcepub fn record_gauge(&self, name: &str, value: f64, labels: MetricLabels)
pub fn record_gauge(&self, name: &str, value: f64, labels: MetricLabels)
Record a gauge metric
Sourcepub fn record_metric(&self, name: &str, value: f64, labels: MetricLabels)
pub fn record_metric(&self, name: &str, value: f64, labels: MetricLabels)
Record a histogram metric
Sourcepub async fn record_event_metrics(&self, metrics: EventMetrics)
pub async fn record_event_metrics(&self, metrics: EventMetrics)
Record event-specific metrics
Sourcepub async fn get_performance_metrics(&self) -> PerformanceMetrics
pub async fn get_performance_metrics(&self) -> PerformanceMetrics
Get current performance metrics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MetricsCollector
impl !RefUnwindSafe for MetricsCollector
impl Send for MetricsCollector
impl Sync for MetricsCollector
impl Unpin for MetricsCollector
impl !UnwindSafe for MetricsCollector
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> 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 more