pub trait DogstatsdClient {
Show 13 methods
// Required methods
fn incr<S>(&self, metric: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>;
fn decr<S>(&self, metric: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>;
fn count<S>(&self, metric: &str, count: i64, tags: impl TagsProvider<S>)
where S: AsRef<str>;
fn time<S, F, O>(
&self,
metric: &str,
tags: impl TagsProvider<S>,
block: F,
) -> O
where S: AsRef<str>,
F: FnOnce() -> O;
fn async_time<'life0, 'life1, 'async_trait, S, F, T, O>(
&'life0 self,
metric: &'life1 str,
tags: impl 'async_trait + TagsProvider<S> + Send + Sync,
block: F,
) -> Pin<Box<dyn Future<Output = O> + Send + 'async_trait>>
where S: AsRef<str> + Sync + 'async_trait,
F: FnOnce() -> T + Send + 'async_trait,
T: Future<Output = O> + Send + 'async_trait,
O: 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn timing<S>(&self, metric: &str, ms: i64, tags: impl TagsProvider<S>)
where S: AsRef<str>;
fn gauge<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>;
fn histogram<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>;
fn distribution<S>(
&self,
metric: &str,
val: &str,
tags: impl TagsProvider<S>,
)
where S: AsRef<str>;
fn set<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>;
fn service_check<S>(
&self,
metric: &str,
val: ServiceStatus,
tags: impl TagsProvider<S>,
options: Option<ServiceCheckOptions<'_>>,
)
where S: AsRef<str>;
fn event<S>(&self, title: &str, text: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>;
fn event_with_options<S>(
&self,
title: &str,
text: &str,
tags: impl TagsProvider<S>,
options: Option<EventOptions<'_>>,
)
where S: AsRef<str>;
}Expand description
This trait represent a client that is able to interact with the datadog statsd collector. Its main use in this library is having a common interface for the underlying implementation, and being able to mock it for testing purposes
Required Methods§
Sourcefn incr<S>(&self, metric: &str, tags: impl TagsProvider<S>)
fn incr<S>(&self, metric: &str, tags: impl TagsProvider<S>)
Increment a StatsD counter
Sourcefn decr<S>(&self, metric: &str, tags: impl TagsProvider<S>)
fn decr<S>(&self, metric: &str, tags: impl TagsProvider<S>)
Decrement a StatsD counter
Sourcefn count<S>(&self, metric: &str, count: i64, tags: impl TagsProvider<S>)
fn count<S>(&self, metric: &str, count: i64, tags: impl TagsProvider<S>)
Make an arbitrary change to a StatsD counter
Sourcefn time<S, F, O>(&self, metric: &str, tags: impl TagsProvider<S>, block: F) -> O
fn time<S, F, O>(&self, metric: &str, tags: impl TagsProvider<S>, block: F) -> O
Time how long it takes for a block of code to execute
fn async_time<'life0, 'life1, 'async_trait, S, F, T, O>( &'life0 self, metric: &'life1 str, tags: impl 'async_trait + TagsProvider<S> + Send + Sync, block: F, ) -> Pin<Box<dyn Future<Output = O> + Send + 'async_trait>>
Sourcefn timing<S>(&self, metric: &str, ms: i64, tags: impl TagsProvider<S>)
fn timing<S>(&self, metric: &str, ms: i64, tags: impl TagsProvider<S>)
Send your own timing metric in milliseconds
Sourcefn gauge<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
fn gauge<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
Report an arbitrary value as a gauge
Sourcefn histogram<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
fn histogram<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
Report a value in a histogram
Sourcefn distribution<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
fn distribution<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
Report a value in a distribution
Sourcefn set<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
fn set<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
Report a value in a set
Sourcefn service_check<S>(
&self,
metric: &str,
val: ServiceStatus,
tags: impl TagsProvider<S>,
options: Option<ServiceCheckOptions<'_>>,
)
fn service_check<S>( &self, metric: &str, val: ServiceStatus, tags: impl TagsProvider<S>, options: Option<ServiceCheckOptions<'_>>, )
Report the status of a service
Sourcefn event<S>(&self, title: &str, text: &str, tags: impl TagsProvider<S>)
fn event<S>(&self, title: &str, text: &str, tags: impl TagsProvider<S>)
Send a custom event as a title and a body
Sourcefn event_with_options<S>(
&self,
title: &str,
text: &str,
tags: impl TagsProvider<S>,
options: Option<EventOptions<'_>>,
)
fn event_with_options<S>( &self, title: &str, text: &str, tags: impl TagsProvider<S>, options: Option<EventOptions<'_>>, )
Send a custom event as a title and a body
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.