DogstatsdClient

Trait DogstatsdClient 

Source
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§

Source

fn incr<S>(&self, metric: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Increment a StatsD counter

Source

fn decr<S>(&self, metric: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Decrement a StatsD counter

Source

fn count<S>(&self, metric: &str, count: i64, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Make an arbitrary change to a StatsD counter

Source

fn time<S, F, O>(&self, metric: &str, tags: impl TagsProvider<S>, block: F) -> O
where S: AsRef<str>, F: FnOnce() -> O,

Time how long it takes for a block of code to execute

Source

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,

Source

fn timing<S>(&self, metric: &str, ms: i64, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Send your own timing metric in milliseconds

Source

fn gauge<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Report an arbitrary value as a gauge

Source

fn histogram<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Report a value in a histogram

Source

fn distribution<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Report a value in a distribution

Source

fn set<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Report a value in a set

Source

fn service_check<S>( &self, metric: &str, val: ServiceStatus, tags: impl TagsProvider<S>, options: Option<ServiceCheckOptions<'_>>, )
where S: AsRef<str>,

Report the status of a service

Source

fn event<S>(&self, title: &str, text: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Send a custom event as a title and a body

Source

fn event_with_options<S>( &self, title: &str, text: &str, tags: impl TagsProvider<S>, options: Option<EventOptions<'_>>, )
where S: AsRef<str>,

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.

Implementations on Foreign Types§

Source§

impl DogstatsdClient for Client

Source§

fn incr<S>(&self, metric: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Source§

fn decr<S>(&self, metric: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Source§

fn count<S>(&self, metric: &str, count: i64, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Source§

fn time<S, F, O>(&self, metric: &str, tags: impl TagsProvider<S>, block: F) -> O
where S: AsRef<str>, F: FnOnce() -> O,

Source§

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,

Source§

fn timing<S>(&self, metric: &str, ms: i64, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Source§

fn gauge<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Source§

fn histogram<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Source§

fn distribution<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Source§

fn set<S>(&self, metric: &str, val: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Source§

fn service_check<S>( &self, metric: &str, val: ServiceStatus, tags: impl TagsProvider<S>, options: Option<ServiceCheckOptions<'_>>, )
where S: AsRef<str>,

Source§

fn event<S>(&self, title: &str, text: &str, tags: impl TagsProvider<S>)
where S: AsRef<str>,

Source§

fn event_with_options<S>( &self, title: &str, text: &str, tags: impl TagsProvider<S>, options: Option<EventOptions<'_>>, )
where S: AsRef<str>,

Implementors§