pub struct DynamicDistribution { /* private fields */ }Expand description
Distribution keyed by runtime label sets.
Each label set gets its own set of thread-local exponential histogram buckets.
Implementations§
Source§impl DynamicDistribution
impl DynamicDistribution
Sourcepub fn new(shard_count: usize) -> Self
pub fn new(shard_count: usize) -> Self
Creates a new runtime-labeled distribution with default cardinality cap.
Sourcepub fn with_max_series(shard_count: usize, max_series: usize) -> Self
pub fn with_max_series(shard_count: usize, max_series: usize) -> Self
Creates a new runtime-labeled distribution with a custom cardinality cap.
Sourcepub fn series(&self, labels: &[(&str, &str)]) -> DynamicDistributionSeries
pub fn series(&self, labels: &[(&str, &str)]) -> DynamicDistributionSeries
Resolve a reusable series handle for labels.
Preferred for hot paths when labels come from a finite active set.
Sourcepub fn record(&self, labels: &[(&str, &str)], value: u64)
pub fn record(&self, labels: &[(&str, &str)], value: u64)
Record a value for the series identified by labels.
Sourcepub fn count(&self, labels: &[(&str, &str)]) -> u64
pub fn count(&self, labels: &[(&str, &str)]) -> u64
Get count for the series identified by labels.
Sourcepub fn snapshot(&self) -> Vec<(DynamicLabelSet, u64, u64, ExpBucketsSnapshot)>
pub fn snapshot(&self) -> Vec<(DynamicLabelSet, u64, u64, ExpBucketsSnapshot)>
Returns a snapshot of all label-sets with their stats.
Sourcepub fn cardinality(&self) -> usize
pub fn cardinality(&self) -> usize
Returns the current number of distinct label sets.
Sourcepub fn overflow_count(&self) -> u64
pub fn overflow_count(&self) -> u64
Returns the number of records routed to the overflow bucket.
A non-zero value indicates the cardinality cap was hit and label fidelity is being lost. Use this to alert on cardinality pressure.
Sourcepub fn evict_stale(&self, max_staleness: u32) -> usize
pub fn evict_stale(&self, max_staleness: u32) -> usize
Evict series that haven’t been accessed for max_staleness cycles.
Call this after advance_cycle() in your sweeper task.
Series are marked as evicted (so cached handles see the tombstone),
then removed from the index.
Protected series (Arc::strong_count > 1) are never evicted — someone holds a DynamicDistributionSeries handle to them.
Returns the number of series evicted.
Trait Implementations§
Source§impl ClickHouseExport for DynamicDistribution
impl ClickHouseExport for DynamicDistribution
fn export_clickhouse( &self, batch: &mut ClickHouseMetricBatch, name: &str, description: &str, time_unix_nano: u64, )
Source§impl OtlpExport for DynamicDistribution
impl OtlpExport for DynamicDistribution
Auto Trait Implementations§
impl !Freeze for DynamicDistribution
impl !RefUnwindSafe for DynamicDistribution
impl Send for DynamicDistribution
impl Sync for DynamicDistribution
impl Unpin for DynamicDistribution
impl UnsafeUnpin for DynamicDistribution
impl !UnwindSafe for DynamicDistribution
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request