pub struct MetricsCollector { /* private fields */ }Expand description
Metrics collector for gathering and storing metrics
Implementations§
Source§impl MetricsCollector
impl MetricsCollector
Sourcepub fn with_config(config: MetricsConfig) -> Self
pub fn with_config(config: MetricsConfig) -> Self
Create a new metrics collector with configuration
Sourcepub async fn initialize(&mut self) -> Result<(), String>
pub async fn initialize(&mut self) -> Result<(), String>
Initialize the metrics collector
Sourcepub async fn get_metrics(
&self,
metric_name: &str,
time_range: TimeRange,
) -> Result<Vec<Metric>, String>
pub async fn get_metrics( &self, metric_name: &str, time_range: TimeRange, ) -> Result<Vec<Metric>, String>
Get metrics for a specific name and time range
Sourcepub async fn get_aggregated(
&self,
metric_name: &str,
aggregation: AggregationType,
time_range: TimeRange,
) -> Result<AggregatedMetric, String>
pub async fn get_aggregated( &self, metric_name: &str, aggregation: AggregationType, time_range: TimeRange, ) -> Result<AggregatedMetric, String>
Get aggregated metrics
Sourcepub async fn get_metrics_count(&self) -> Result<usize, String>
pub async fn get_metrics_count(&self) -> Result<usize, String>
Get the number of metrics stored
Trait Implementations§
Source§impl Clone for MetricsCollector
impl Clone for MetricsCollector
Source§fn clone(&self) -> MetricsCollector
fn clone(&self) -> MetricsCollector
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto 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