pub struct InMemoryMetricsRepository { /* private fields */ }Expand description
In-memory implementation of MetricsRepository for testing and development.
Security Note: This implementation includes memory limits to prevent OOM attacks when used in production scenarios. Configure limits appropriately for your use case.
Implementations§
Source§impl InMemoryMetricsRepository
impl InMemoryMetricsRepository
Sourcepub fn with_config(config: InMemoryMetricsConfig) -> Self
pub fn with_config(config: InMemoryMetricsConfig) -> Self
Creates a new in-memory metrics repository with custom configuration.
Sourcepub async fn memory_stats(&self) -> MemoryStats
pub async fn memory_stats(&self) -> MemoryStats
Returns the current memory usage statistics.
Trait Implementations§
Source§impl Clone for InMemoryMetricsRepository
impl Clone for InMemoryMetricsRepository
Source§fn clone(&self) -> InMemoryMetricsRepository
fn clone(&self) -> InMemoryMetricsRepository
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 moreSource§impl Default for InMemoryMetricsRepository
impl Default for InMemoryMetricsRepository
Source§impl MetricsRepository for InMemoryMetricsRepository
impl MetricsRepository for InMemoryMetricsRepository
Source§fn store_metric<'life0, 'life1, 'async_trait>(
&'life0 self,
metric_name: &'life1 str,
value: MetricValue,
timestamp: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = AnalyzerResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_metric<'life0, 'life1, 'async_trait>(
&'life0 self,
metric_name: &'life1 str,
value: MetricValue,
timestamp: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = AnalyzerResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stores a metric value.
Source§fn get_metric_history<'life0, 'life1, 'async_trait>(
&'life0 self,
metric_name: &'life1 str,
since: Option<DateTime<Utc>>,
until: Option<DateTime<Utc>>,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = AnalyzerResult<Vec<MetricDataPoint>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_metric_history<'life0, 'life1, 'async_trait>(
&'life0 self,
metric_name: &'life1 str,
since: Option<DateTime<Utc>>,
until: Option<DateTime<Utc>>,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = AnalyzerResult<Vec<MetricDataPoint>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves historical values for a metric. Read more
Source§fn store_context<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 AnalyzerContext,
) -> Pin<Box<dyn Future<Output = AnalyzerResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_context<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 AnalyzerContext,
) -> Pin<Box<dyn Future<Output = AnalyzerResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stores metrics from an analyzer context.
Auto Trait Implementations§
impl Freeze for InMemoryMetricsRepository
impl !RefUnwindSafe for InMemoryMetricsRepository
impl Send for InMemoryMetricsRepository
impl Sync for InMemoryMetricsRepository
impl Unpin for InMemoryMetricsRepository
impl !UnwindSafe for InMemoryMetricsRepository
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 more