Skip to main content

NativeHistogramConfig

Struct NativeHistogramConfig 

Source
pub struct NativeHistogramConfig { /* private fields */ }
Expand description

Configuration for native histogram buckets.

Native histogram exemplars are not currently emitted.

Implementations§

Source§

impl NativeHistogramConfig

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> NativeHistogramConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for NativeHistogramConfig

Source§

impl Debug for NativeHistogramConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NativeHistogramConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.