pub struct AggregationEngine { /* private fields */ }Expand description
Real-time aggregation engine
Implementations§
Source§impl AggregationEngine
impl AggregationEngine
Sourcepub async fn new(config: Arc<AnalyticsConfig>) -> Result<Self>
pub async fn new(config: Arc<AnalyticsConfig>) -> Result<Self>
Create a new aggregation engine
Sourcepub fn add_point(
&self,
metric_name: &str,
value: f64,
timestamp: DateTime<Utc>,
_tags: HashMap<String, String>,
) -> Result<()>
pub fn add_point( &self, metric_name: &str, value: f64, timestamp: DateTime<Utc>, _tags: HashMap<String, String>, ) -> Result<()>
Add a data point to aggregation
Sourcepub fn get_aggregated(
&self,
metric_name: &str,
window: TimeWindow,
) -> Option<AggregatedMetric>
pub fn get_aggregated( &self, metric_name: &str, window: TimeWindow, ) -> Option<AggregatedMetric>
Get aggregated metrics for a time window
Sourcepub fn get_all_aggregated(&self, window: TimeWindow) -> Vec<AggregatedMetric>
pub fn get_all_aggregated(&self, window: TimeWindow) -> Vec<AggregatedMetric>
Get all aggregated metrics for a window
Sourcepub fn reset_metric(&self, metric_name: &str)
pub fn reset_metric(&self, metric_name: &str)
Reset aggregation state for a metric
Sourcepub fn get_stats(&self) -> AggregationStats
pub fn get_stats(&self) -> AggregationStats
Get aggregation statistics
Auto Trait Implementations§
impl Freeze for AggregationEngine
impl !RefUnwindSafe for AggregationEngine
impl Send for AggregationEngine
impl Sync for AggregationEngine
impl Unpin for AggregationEngine
impl !UnwindSafe for AggregationEngine
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 moreCreates a shared type from an unshared type.