[−][src]Struct cadence::StatsdClientBuilder
Builder for creating and customizing StatsdClient instances.
Instances of the builder should be created by calling the ::builder()
method on the StatsClient struct.
Example
use cadence::prelude::*; use cadence::{MetricError, StatsdClient, NopMetricSink}; fn my_error_handler(err: MetricError) { println!("Metric error! {}", err); } let client = StatsdClient::builder("prefix", NopMetricSink) .with_error_handler(my_error_handler) .build(); client.count("something", 123); client.count_with_tags("some.counter", 42) .with_tag("region", "us-east-2") .send();
Methods
impl StatsdClientBuilder[src]
pub fn with_error_handler<F>(self, errors: F) -> Self where
F: Fn(MetricError) + Sync + Send + RefUnwindSafe + 'static, [src]
F: Fn(MetricError) + Sync + Send + RefUnwindSafe + 'static,
Set an error handler to use for metrics sent via MetricBuilder::send()
The error handler is only invoked when metrics are not able to be sent
correctly. Either due to invalid input, I/O errors encountered when trying
to send them via a MetricSink, or some other reason.
The error handler should consume the error without panicking. The error may be logged, printed to stderr, discarded, etc. - this is up to the implementation.
pub fn build(self) -> StatsdClient[src]
Construct a new StatsdClient instance based on current settings.
Auto Trait Implementations
impl Send for StatsdClientBuilder
impl Sync for StatsdClientBuilder
impl Unpin for StatsdClientBuilder
impl !UnwindSafe for StatsdClientBuilder
impl RefUnwindSafe for StatsdClientBuilder
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,