Datadog

Struct Datadog 

Source
pub struct Datadog<C: DogstatsdClient> { /* private fields */ }
Expand description

The Datadog type is the main entry point for the library

Implementations§

Source§

impl Datadog<Client>

Source

pub fn init(configuration: Configuration) -> Result<(), Error>

Initializes a Datadog instance with a struct that implements the Configuration trait. Make sure that you run it only once otherwise you will get an error.

Source

pub fn incr<S: AsRef<str>>(metric: impl AsRef<str>, tags: impl TagsProvider<S>)

Increment a StatsD counter

Source

pub fn decr<S: AsRef<str>>(metric: impl AsRef<str>, tags: impl TagsProvider<S>)

Decrement a StatsD counter

Source

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

Make an arbitrary change to a StatsD counter

Source

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

Time a block of code (reports in ms)

Source

pub async fn async_time<S, F, T, O>( metric: &str, tags: impl TagsProvider<S> + Send + Sync, block: F, ) -> O
where S: AsRef<str> + Sync, F: FnOnce() -> T + Send, T: Future<Output = O> + Send,

Source

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

Send your own timing metric in milliseconds

Source

pub fn gauge<S: AsRef<str>>( metric: impl AsRef<str>, value: impl AsRef<str>, tags: impl TagsProvider<S>, )

Report an arbitrary value as a gauge

Source

pub fn histogram<S: AsRef<str>>( metric: impl AsRef<str>, value: impl AsRef<str>, tags: impl TagsProvider<S>, )

Report a value in a histogram

Source

pub fn distribution<S: AsRef<str>>( metric: impl AsRef<str>, value: impl AsRef<str>, tags: impl TagsProvider<S>, )

Report a value in a distribution

Source

pub fn set<S: AsRef<str>>( metric: impl AsRef<str>, value: impl AsRef<str>, tags: impl TagsProvider<S>, )

Report a value in a set

Source

pub fn service_check<S: AsRef<str>>( metric: impl AsRef<str>, value: ServiceStatus, tags: impl TagsProvider<S>, options: Option<ServiceCheckOptions<'_>>, )

Report the status of a service

Source

pub fn event<S: AsRef<str>>( metric: impl AsRef<str>, text: impl AsRef<str>, tags: impl TagsProvider<S>, )

Send a custom event as a title and a body

Source

pub fn event_with_options<S: AsRef<str>>( metric: impl AsRef<str>, text: impl AsRef<str>, tags: impl TagsProvider<S>, options: Option<EventOptions<'_>>, )

Send a custom event as a title, a body and some options

Source

pub fn enter_timing<S: AsRef<str>, P: TagsProvider<S>>( metric: impl AsRef<str>, tags: P, ) -> TimingGuard<S, P>

Acquire a timing guard. When this guard is dropped, it will emit a timing metric for the duration it existed. The metric name is metric, and the tags are tags.

Auto Trait Implementations§

§

impl<C> !Freeze for Datadog<C>

§

impl<C> RefUnwindSafe for Datadog<C>
where C: RefUnwindSafe,

§

impl<C> Send for Datadog<C>
where C: Send,

§

impl<C> Sync for Datadog<C>
where C: Sync,

§

impl<C> Unpin for Datadog<C>
where C: Unpin,

§

impl<C> UnwindSafe for Datadog<C>
where C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V