pub struct GenericMetricsCollector<T>where
T: CollectibleMetrics,{ /* private fields */ }Expand description
Generic metrics collector for any operation type
Implementations§
Source§impl<T> GenericMetricsCollector<T>where
T: CollectibleMetrics,
impl<T> GenericMetricsCollector<T>where
T: CollectibleMetrics,
Sourcepub fn with_config(
collector_name: String,
max_entries: usize,
auto_aggregate: bool,
) -> Self
pub fn with_config( collector_name: String, max_entries: usize, auto_aggregate: bool, ) -> Self
Creates a new metrics collector with custom configuration
Sourcepub fn start_operation(&self, operation_id: String) -> Result<(), PipelineError>
pub fn start_operation(&self, operation_id: String) -> Result<(), PipelineError>
Starts tracking an operation
Sourcepub fn complete_operation(
&self,
operation_id: String,
operation_type: String,
metrics: T,
) -> Result<(), PipelineError>
pub fn complete_operation( &self, operation_id: String, operation_type: String, metrics: T, ) -> Result<(), PipelineError>
Completes an operation and records metrics
Sourcepub fn record_entry(&self, entry: MetricEntry<T>) -> Result<(), PipelineError>
pub fn record_entry(&self, entry: MetricEntry<T>) -> Result<(), PipelineError>
Records a metric entry directly
Sourcepub fn record_failure(
&self,
operation_id: String,
operation_type: String,
error: PipelineError,
) -> Result<(), PipelineError>
pub fn record_failure( &self, operation_id: String, operation_type: String, error: PipelineError, ) -> Result<(), PipelineError>
Records an operation failure
Sourcepub fn get_aggregated_metrics(&self) -> Result<T, PipelineError>
pub fn get_aggregated_metrics(&self) -> Result<T, PipelineError>
Gets the current aggregated metrics
Sourcepub fn get_entries(&self) -> Result<Vec<MetricEntry<T>>, PipelineError>
pub fn get_entries(&self) -> Result<Vec<MetricEntry<T>>, PipelineError>
Gets all recorded entries
Sourcepub fn get_entries_by_type(
&self,
operation_type: &str,
) -> Result<Vec<MetricEntry<T>>, PipelineError>
pub fn get_entries_by_type( &self, operation_type: &str, ) -> Result<Vec<MetricEntry<T>>, PipelineError>
Gets entries filtered by operation type
Sourcepub fn get_entries_in_range(
&self,
start: DateTime<Utc>,
end: DateTime<Utc>,
) -> Result<Vec<MetricEntry<T>>, PipelineError>
pub fn get_entries_in_range( &self, start: DateTime<Utc>, end: DateTime<Utc>, ) -> Result<Vec<MetricEntry<T>>, PipelineError>
Gets entries within a time range
Sourcepub fn reset(&self) -> Result<(), PipelineError>
pub fn reset(&self) -> Result<(), PipelineError>
Resets all metrics and entries
Sourcepub fn get_summary(&self) -> Result<HashMap<String, String>, PipelineError>
pub fn get_summary(&self) -> Result<HashMap<String, String>, PipelineError>
Gets summary statistics
Sourcepub fn active_operations_count(&self) -> Result<usize, PipelineError>
pub fn active_operations_count(&self) -> Result<usize, PipelineError>
Gets the number of active operations
Auto Trait Implementations§
impl<T> !Freeze for GenericMetricsCollector<T>
impl<T> RefUnwindSafe for GenericMetricsCollector<T>
impl<T> Send for GenericMetricsCollector<T>
impl<T> Sync for GenericMetricsCollector<T>
impl<T> Unpin for GenericMetricsCollector<T>where
T: Unpin,
impl<T> UnwindSafe for GenericMetricsCollector<T>
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