pub struct MetricsStore { /* private fields */ }Expand description
Top-level per-service metrics store, keyed by service type (ResourceType as i32).
Implementations§
Source§impl MetricsStore
impl MetricsStore
pub fn new() -> Self
Sourcepub async fn push_sample(&self, service_type: i32, sample: MetricSample)
pub async fn push_sample(&self, service_type: i32, sample: MetricSample)
Push a 1-minute sample for service_type into tier 0 and cascade
rollups into tier 1 / tier 2 as needed.
Sourcepub async fn query(&self, service_type: i32, tier: u8) -> Vec<MetricSample>
pub async fn query(&self, service_type: i32, tier: u8) -> Vec<MetricSample>
Query samples at the given tier for a service.
Returns an empty vec if no data exists for service_type or tier
is out of range.
Sourcepub fn start_sampler(
self,
counters: Arc<HashMap<i32, Arc<ServiceCounters>>>,
interval: Duration,
)
pub fn start_sampler( self, counters: Arc<HashMap<i32, Arc<ServiceCounters>>>, interval: Duration, )
Spawn a background sampler task that periodically snapshots each service’s counters and pushes the samples into the store.
The task runs every interval (typically 60 s) until the runtime
shuts down.
Trait Implementations§
Source§impl Clone for MetricsStore
impl Clone for MetricsStore
Source§fn clone(&self) -> MetricsStore
fn clone(&self) -> MetricsStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MetricsStore
impl Debug for MetricsStore
Auto Trait Implementations§
impl !RefUnwindSafe for MetricsStore
impl !UnwindSafe for MetricsStore
impl Freeze for MetricsStore
impl Send for MetricsStore
impl Sync for MetricsStore
impl Unpin for MetricsStore
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request