pub struct Distribution { /* private fields */ }Expand description
Exponential histogram distribution for high-performance metric recording.
Cells are pre-allocated and indexed by thread_id & mask, so recording is
lock-free with no per-call TLS bookkeeping.
Implementations§
Source§impl Distribution
impl Distribution
Sourcepub fn new(shard_count: usize) -> Self
pub fn new(shard_count: usize) -> Self
Create a new Distribution with shard_count shards.
The count is rounded up to the next power of two for fast modulo.
Sourcepub fn sum_and_count(&self) -> (u64, u64)
pub fn sum_and_count(&self) -> (u64, u64)
Sum and count across all shards in a single pass.
Cheaper than calling Self::sum and Self::count separately:
each shard’s ExpBuckets is visited once, and sum + count share
a cache line per shard so the combined pass roughly halves the cache
traffic of two separate scans.
Sourcepub fn buckets_snapshot(&self) -> ExpBucketsSnapshot
pub fn buckets_snapshot(&self) -> ExpBucketsSnapshot
Merge bucket counts from all shards into a single snapshot.
Trait Implementations§
Source§impl ClickHouseExport for Distribution
impl ClickHouseExport for Distribution
fn export_clickhouse( &self, batch: &mut ClickHouseMetricBatch, name: &str, description: &str, time_unix_nano: u64, )
Source§impl Debug for Distribution
impl Debug for Distribution
Source§impl Default for Distribution
impl Default for Distribution
Source§impl DistributionSnapshot for Distribution
impl DistributionSnapshot for Distribution
Source§impl DogStatsDExport for Distribution
impl DogStatsDExport for Distribution
Source§impl OtlpExport for Distribution
impl OtlpExport for Distribution
Source§impl PrometheusExport for Distribution
impl PrometheusExport for Distribution
Auto Trait Implementations§
impl Freeze for Distribution
impl RefUnwindSafe for Distribution
impl Send for Distribution
impl Sync for Distribution
impl Unpin for Distribution
impl UnsafeUnpin for Distribution
impl UnwindSafe for Distribution
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
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>
Wrap the input message
T in a tonic::Request