pub struct Histogram<V> {
pub name: &'static str,
pub unit: &'static str,
pub description: &'static str,
/* private fields */
}Expand description
A histogram instrument with branchless base-2 exponential bucket pick.
32 buckets span [2^-10, 2^22) — roughly [0.001, 4_000_000). Values
outside that range saturate to bucket 0 or bucket 31. V is the observed
value type: f64 for latencies/sizes, u64 for counts.
v1 baseline: single bucket slab per instrument; tag identity is accepted for API symmetry but not accumulated. C9 will shard by attr-set.
Fields§
§name: &'static str§unit: &'static str§description: &'static strImplementations§
Source§impl<V> Histogram<V>
impl<V> Histogram<V>
pub const fn new(name: &'static str) -> Self
pub const fn unit(self, unit: &'static str) -> Self
pub const fn description(self, desc: &'static str) -> Self
Sourcepub const fn exponential_base(self, base: f64) -> Self
pub const fn exponential_base(self, base: f64) -> Self
Set the exponential base. Only 2.0 is supported for the
branchless bucket pick; other bases will fall back to bucket 0.
Sourcepub const fn exponential_min(self, min: f64) -> Self
pub const fn exponential_min(self, min: f64) -> Self
Set the lower bound of bucket 0 (must be a power of 2 for the fast path).
Sourcepub fn bucket_snapshot(&self) -> [u64; 32]
pub fn bucket_snapshot(&self) -> [u64; 32]
Return a snapshot of per-bucket counts.
Auto Trait Implementations§
impl<V> !Freeze for Histogram<V>
impl<V> RefUnwindSafe for Histogram<V>where
PhantomData<V>: RefUnwindSafe,
impl<V> Send for Histogram<V>where
PhantomData<V>: Send,
impl<V> Sync for Histogram<V>where
PhantomData<V>: Sync,
impl<V> Unpin for Histogram<V>where
PhantomData<V>: Unpin,
impl<V> UnsafeUnpin for Histogram<V>where
PhantomData<V>: UnsafeUnpin,
impl<V> UnwindSafe for Histogram<V>where
PhantomData<V>: UnwindSafe,
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