Struct tokio_cadence::builder::Builder
source · pub struct Builder<T, S> { /* private fields */ }
Expand description
Builder allows you to override various default parameter values before creating an instance of the desired Metric Sink.
Implementations§
source§impl<T, S> Builder<T, S>
impl<T, S> Builder<T, S>
sourcepub fn queue_cap(&mut self, queue_cap: usize) -> &mut Self
pub fn queue_cap(&mut self, queue_cap: usize) -> &mut Self
Sets the maximum metric queue capacity (default: DEFAULT_QUEUE_CAPACITY
).
sourcepub fn buf_size(&mut self, buf_size: usize) -> &mut Self
pub fn buf_size(&mut self, buf_size: usize) -> &mut Self
Sets the batch buffer size (default: DEFAULT_BATCH_BUF_SIZE
).
sourcepub fn max_delay(&mut self, max_delay: Duration) -> &mut Self
pub fn max_delay(&mut self, max_delay: Duration) -> &mut Self
Sets the maximum delay before flushing any buffered metrics (default: DEFAULT_MAX_BATCH_DELAY
).
source§impl<T: ToSocketAddrs> Builder<T, UdpSocket>
impl<T: ToSocketAddrs> Builder<T, UdpSocket>
sourcepub fn build(
self
) -> MetricResult<(TokioBatchUdpMetricSink, Pin<Box<dyn Future<Output = ()> + Send + Sync + 'static>>)>
pub fn build( self ) -> MetricResult<(TokioBatchUdpMetricSink, Pin<Box<dyn Future<Output = ()> + Send + Sync + 'static>>)>
Creates a customized instance of the TokioBatchUdpMetricSink
.
§Errors
Returns an error when unable to resolve the configured host address, or when the configured queue capacity is 0.
source§impl<T: AsRef<Path> + Send + Sync + Unpin + 'static> Builder<T, UnixDatagram>
impl<T: AsRef<Path> + Send + Sync + Unpin + 'static> Builder<T, UnixDatagram>
sourcepub fn build(
self
) -> MetricResult<(TokioBatchUnixMetricSink, Pin<Box<dyn Future<Output = ()> + Send + Sync + 'static>>)>
pub fn build( self ) -> MetricResult<(TokioBatchUnixMetricSink, Pin<Box<dyn Future<Output = ()> + Send + Sync + 'static>>)>
Creates a customized instance of the TokioBatchUnixMetricSink
.
§Errors
Returns an error when the configured queue capacity is 0.
Trait Implementations§
Auto Trait Implementations§
impl<T, S> RefUnwindSafe for Builder<T, S>where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for Builder<T, S>
impl<T, S> Sync for Builder<T, S>
impl<T, S> Unpin for Builder<T, S>
impl<T, S> UnwindSafe for Builder<T, S>where
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more