pub struct MetricsStore { /* private fields */ }Expand description
Metrics store for persisting metrics to PostgreSQL.
Implementations§
Source§impl MetricsStore
impl MetricsStore
Sourcepub async fn store(&self, metrics: Vec<Metric>) -> Result<()>
pub async fn store(&self, metrics: Vec<Metric>) -> Result<()>
Store a batch of metrics to the database.
Sourcepub async fn query(
&self,
name: &str,
from: DateTime<Utc>,
to: DateTime<Utc>,
) -> Result<Vec<Metric>>
pub async fn query( &self, name: &str, from: DateTime<Utc>, to: DateTime<Utc>, ) -> Result<Vec<Metric>>
Query metrics by name and time range.
Sourcepub async fn list_latest(&self) -> Result<Vec<Metric>>
pub async fn list_latest(&self) -> Result<Vec<Metric>>
Get latest value for each unique metric name.
Sourcepub async fn pending_count(&self) -> usize
pub async fn pending_count(&self) -> usize
Get pending count (items buffered but not yet flushed).
Auto Trait Implementations§
impl Freeze for MetricsStore
impl !RefUnwindSafe for MetricsStore
impl Send for MetricsStore
impl Sync for MetricsStore
impl Unpin for MetricsStore
impl !UnwindSafe for MetricsStore
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