pub trait Metrics:
Send
+ Sync
+ 'static {
// Required methods
fn incr_counter<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
value: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn record_gauge<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
value: f64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn start_timer<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<Box<dyn Timer + Send>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn record_histogram<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
value: f64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn record_histogram_with_tags<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
name: &'life1 str,
value: f64,
tags: &'life2 [(&'life3 str, &'life4 str)],
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn incr_counter_with_tags<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
name: &'life1 str,
value: u64,
tags: &'life2 [(&'life3 str, &'life4 str)],
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn record_gauge_with_tags<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
name: &'life1 str,
value: f64,
tags: &'life2 [(&'life3 str, &'life4 str)],
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn record_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 str,
error_type: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn record_success<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
success: bool,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
Simple, injectable metrics trait used by adapters/clients. Keep the surface minimal: counters, gauges and a timer RAII helper.
Required Methods§
Sourcefn incr_counter<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
value: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn incr_counter<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
value: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Increment a named counter by value
.
Sourcefn record_gauge<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
value: f64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn record_gauge<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
value: f64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Record a gauge metric.
Sourcefn start_timer<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<Box<dyn Timer + Send>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn start_timer<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<Box<dyn Timer + Send>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Start a timer for a named operation. Returns a boxed Timer which should be stopped when the operation completes. Implementations may return None if timers aren’t supported.
Sourcefn record_histogram<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
value: f64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn record_histogram<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
value: f64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Record a histogram value for a named metric.
Record a histogram value with tags/labels.
Increment a counter with tags/labels.
Record a gauge with tags/labels.