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>
impl Datadog<Client>
Sourcepub fn init(configuration: Configuration) -> Result<(), Error>
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.
Sourcepub fn incr<S: AsRef<str>>(metric: impl AsRef<str>, tags: impl TagsProvider<S>)
pub fn incr<S: AsRef<str>>(metric: impl AsRef<str>, tags: impl TagsProvider<S>)
Increment a StatsD counter
Sourcepub fn decr<S: AsRef<str>>(metric: impl AsRef<str>, tags: impl TagsProvider<S>)
pub fn decr<S: AsRef<str>>(metric: impl AsRef<str>, tags: impl TagsProvider<S>)
Decrement a StatsD counter
Sourcepub fn count<S: AsRef<str>>(
metric: impl AsRef<str>,
count: i64,
tags: impl TagsProvider<S>,
)
pub fn count<S: AsRef<str>>( metric: impl AsRef<str>, count: i64, tags: impl TagsProvider<S>, )
Make an arbitrary change to a StatsD counter
Sourcepub fn time<S, F, O>(
metric: impl AsRef<str>,
tags: impl TagsProvider<S>,
block: F,
) -> O
pub fn time<S, F, O>( metric: impl AsRef<str>, tags: impl TagsProvider<S>, block: F, ) -> O
Time a block of code (reports in ms)
pub async fn async_time<S, F, T, O>( metric: &str, tags: impl TagsProvider<S> + Send + Sync, block: F, ) -> O
Sourcepub fn timing<S: AsRef<str>>(
metric: impl AsRef<str>,
ms: i64,
tags: impl TagsProvider<S>,
)
pub fn timing<S: AsRef<str>>( metric: impl AsRef<str>, ms: i64, tags: impl TagsProvider<S>, )
Send your own timing metric in milliseconds
Sourcepub fn gauge<S: AsRef<str>>(
metric: impl AsRef<str>,
value: impl AsRef<str>,
tags: impl TagsProvider<S>,
)
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
Sourcepub fn histogram<S: AsRef<str>>(
metric: impl AsRef<str>,
value: impl AsRef<str>,
tags: impl TagsProvider<S>,
)
pub fn histogram<S: AsRef<str>>( metric: impl AsRef<str>, value: impl AsRef<str>, tags: impl TagsProvider<S>, )
Report a value in a histogram
Sourcepub fn distribution<S: AsRef<str>>(
metric: impl AsRef<str>,
value: impl AsRef<str>,
tags: impl TagsProvider<S>,
)
pub fn distribution<S: AsRef<str>>( metric: impl AsRef<str>, value: impl AsRef<str>, tags: impl TagsProvider<S>, )
Report a value in a distribution
Sourcepub fn set<S: AsRef<str>>(
metric: impl AsRef<str>,
value: impl AsRef<str>,
tags: impl TagsProvider<S>,
)
pub fn set<S: AsRef<str>>( metric: impl AsRef<str>, value: impl AsRef<str>, tags: impl TagsProvider<S>, )
Report a value in a set
Sourcepub fn service_check<S: AsRef<str>>(
metric: impl AsRef<str>,
value: ServiceStatus,
tags: impl TagsProvider<S>,
options: Option<ServiceCheckOptions<'_>>,
)
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
Sourcepub fn event<S: AsRef<str>>(
metric: impl AsRef<str>,
text: impl AsRef<str>,
tags: impl TagsProvider<S>,
)
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
Sourcepub fn event_with_options<S: AsRef<str>>(
metric: impl AsRef<str>,
text: impl AsRef<str>,
tags: impl TagsProvider<S>,
options: Option<EventOptions<'_>>,
)
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
Sourcepub fn enter_timing<S: AsRef<str>, P: TagsProvider<S>>(
metric: impl AsRef<str>,
tags: P,
) -> TimingGuard<S, P>
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.