pub struct BackgroundMetrics { /* private fields */ }Expand description
Shared metrics for background activity tracking.
Updated by decay/autopilot spawn loops so the API can expose what background jobs are doing to user memories. Persisted to storage so metrics survive restarts.
Implementations§
Source§impl BackgroundMetrics
impl BackgroundMetrics
pub fn new() -> Self
Sourcepub fn restore(inner: BackgroundMetricsInner) -> Self
pub fn restore(inner: BackgroundMetricsInner) -> Self
Restore metrics from a previously persisted snapshot.
Sourcepub fn clear_dirty(&self)
pub fn clear_dirty(&self)
Clear the dirty flag after a successful persist.
Sourcepub fn record_decay(&self, result: &DecayResult)
pub fn record_decay(&self, result: &DecayResult)
Record a decay cycle result.
Sourcepub fn record_dedup(
&self,
namespaces_processed: usize,
memories_scanned: usize,
duplicates_removed: usize,
)
pub fn record_dedup( &self, namespaces_processed: usize, memories_scanned: usize, duplicates_removed: usize, )
Record a dedup cycle result.
Sourcepub fn record_consolidation(
&self,
namespaces_processed: usize,
memories_scanned: usize,
clusters_merged: usize,
memories_consolidated: usize,
)
pub fn record_consolidation( &self, namespaces_processed: usize, memories_scanned: usize, clusters_merged: usize, memories_consolidated: usize, )
Record a consolidation cycle result.
Sourcepub fn restore_into(&self, restored: BackgroundMetricsInner)
pub fn restore_into(&self, restored: BackgroundMetricsInner)
Replace the inner state with a restored snapshot (used on startup).
Sourcepub fn snapshot(&self) -> BackgroundMetricsInner
pub fn snapshot(&self) -> BackgroundMetricsInner
Get a snapshot of all metrics for API response.
Trait Implementations§
Source§impl Debug for BackgroundMetrics
impl Debug for BackgroundMetrics
Source§impl Default for BackgroundMetrics
impl Default for BackgroundMetrics
Source§fn default() -> BackgroundMetrics
fn default() -> BackgroundMetrics
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for BackgroundMetrics
impl RefUnwindSafe for BackgroundMetrics
impl Send for BackgroundMetrics
impl Sync for BackgroundMetrics
impl Unpin for BackgroundMetrics
impl UnsafeUnpin for BackgroundMetrics
impl UnwindSafe for BackgroundMetrics
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