pub struct Configuration<T> { /* private fields */ }
Expand description
A configuration builder for Receiver
.
Implementations§
Source§impl<T: Send + Eq + Hash + Display + Clone> Configuration<T>
impl<T: Send + Eq + Hash + Display + Clone> Configuration<T>
Sourcepub fn new() -> Configuration<T>
pub fn new() -> Configuration<T>
Creates a new Configuration
with default values.
Sourcepub fn capacity(self, capacity: usize) -> Self
pub fn capacity(self, capacity: usize) -> Self
Sets the buffer capacity.
Defaults to 512.
This controls the size of the channel used to send metrics. This channel is shared amongst all active sinks. If this channel is full when sending a metric, that send will be blocked until the channel has free space.
Tweaking this value allows for a trade-off between low memory consumption and throughput burst capabilities. By default, we expect samples to occupy approximately 64 bytes. Thus, at our default value, we preallocate roughly ~32KB.
Generally speaking, sending and processing metrics is fast enough that the default value of 4096 supports millions of samples per second.
Sourcepub fn batch_size(self, batch_size: usize) -> Self
pub fn batch_size(self, batch_size: usize) -> Self
Sets the batch size.
Defaults to 64.
This controls the size of message batches that we collect for processing. The only real reason to tweak this is to control the latency from the sender side. Larger batches lower the ingest latency in the face of high metric ingest pressure at the cost of higher tail latencies.
Long story short, you shouldn’t need to change this, but it’s here if you really do.
Sourcepub fn histogram(self, window: Duration, granularity: Duration) -> Self
pub fn histogram(self, window: Duration, granularity: Duration) -> Self
Sets the histogram configuration.
Defaults to a 10 second window with 1 second granularity.
This controls how long of a time frame the histogram will track, on a rolling window. We’ll create enough underlying histogram buckets so that we have (window / granularity) buckets, and every interval that passes (granularity), we’ll add a new bucket and drop the oldest one, thereby providing a rolling window.
Histograms, under the hood, are hard-coded to track three significant digits, and will take a theoretical maximum of around 60KB per bucket, so a single histogram metric with the default window/granularity will take a maximum of around 600KB.
In practice, this should be much smaller based on the maximum values pushed into the histogram, as the underlying histogram storage is automatically resized on the fly.
Sourcepub fn percentiles(self, percentiles: &[f64]) -> Self
pub fn percentiles(self, percentiles: &[f64]) -> Self
Sets the default percentiles for histograms.
Defaults to min/p50/p95/p99/p999/max.
This controls the percentiles we extract from histograms when taking a snapshot. Percentiles are represented in metrics as pXXX, where XXX is the percentile i.e. p99 is 99.0, p999 is 99.9, etc. min and max are 0.0 and 100.0, respectively.
Trait Implementations§
Source§impl<T: Clone> Clone for Configuration<T>
impl<T: Clone> Clone for Configuration<T>
Source§fn clone(&self) -> Configuration<T>
fn clone(&self) -> Configuration<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more