pub struct NativeHistogramConfig { /* private fields */ }Expand description
Configuration for native histogram buckets.
Native histogram exemplars are not currently emitted.
Implementations§
Source§impl NativeHistogramConfig
impl NativeHistogramConfig
Sourcepub fn new(bucket_factor: f64) -> Self
pub fn new(bucket_factor: f64) -> Self
Create a native histogram configuration with the provided bucket factor.
The schema is chosen so that the bucket growth factor is the largest
supported factor that is still <= bucket_factor. The default zero
threshold is 2^-128, as recommended by the Prometheus native histogram
specification.
Sourcepub fn with_schema(schema: i8) -> Self
pub fn with_schema(schema: i8) -> Self
Create a native histogram configuration with the provided schema.
Valid standard schema values are in [-4, 8]. Prefer Self::new unless
you explicitly need a schema-level configuration.
Sourcepub fn with_bucket_factor(bucket_factor: f64) -> Self
pub fn with_bucket_factor(bucket_factor: f64) -> Self
Create a native histogram configuration by choosing the schema whose
growth factor is the largest factor <= bucket_factor.
Sourcepub fn zero_threshold(self, zero_threshold: f64) -> Self
pub fn zero_threshold(self, zero_threshold: f64) -> Self
Set a custom zero threshold.
A value of 0.0 keeps the default threshold. A negative value configures
a zero-width zero bucket.
Sourcepub fn max_buckets(self, max_buckets: usize) -> Self
pub fn max_buckets(self, max_buckets: usize) -> Self
Set a best-effort maximum number of sparse buckets across both sides.
0 means unbounded. If the lowest supported resolution still exceeds
the limit, observations remain in sparse buckets until a later zero
bucket widening can merge them.
Sourcepub fn min_reset_duration(self, min_reset_duration: Duration) -> Self
pub fn min_reset_duration(self, min_reset_duration: Duration) -> Self
Reset the histogram instead of reducing resolution if the bucket limit is exceeded after at least this duration has elapsed since creation or the last reset. A zero duration disables reset-based limiting.
Sourcepub fn max_zero_threshold(self, max_zero_threshold: f64) -> Self
pub fn max_zero_threshold(self, max_zero_threshold: f64) -> Self
Set the maximum zero threshold allowed while enforcing max_buckets.
The default is 0.0, which disables zero-bucket widening unless the
current threshold is already below a configured positive maximum.
Trait Implementations§
Source§impl Clone for NativeHistogramConfig
impl Clone for NativeHistogramConfig
Source§fn clone(&self) -> NativeHistogramConfig
fn clone(&self) -> NativeHistogramConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more