pub struct DDSketch { /* private fields */ }Expand description
This is a minimal DDSketch implementation
This implementation only supports a part of the standard (which is also only the parts dd backend supports :shrug:)
- max length contiguous bin store, with lower bin collapse behavior.
- Positive or zero values
The default sketch has a 1% relative accuracy, and only accepts positive points
See https://github.com/DataDog/sketches-go for the reference implementation
Implementations§
Source§impl DDSketch
impl DDSketch
Sourcepub fn ordered_bins(&self) -> Vec<(f64, f64)>
pub fn ordered_bins(&self) -> Vec<(f64, f64)>
Return an iterator over (value, weight) pair for each bin
pub fn count(&self) -> f64
Sourcepub fn add(&mut self, point: f64) -> Result<(), Box<dyn Error>>
pub fn add(&mut self, point: f64) -> Result<(), Box<dyn Error>>
Add a point with value point to the sketch
point must be positive
Sourcepub fn add_with_count(
&mut self,
point: f64,
count: f64,
) -> Result<(), Box<dyn Error>>
pub fn add_with_count( &mut self, point: f64, count: f64, ) -> Result<(), Box<dyn Error>>
Add count point with value point to the sketch
count and point must be positive
Sourcepub fn encode_to_vec(self) -> Vec<u8> ⓘ
pub fn encode_to_vec(self) -> Vec<u8> ⓘ
Return a serialized protobuf of the sketch
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DDSketch
impl RefUnwindSafe for DDSketch
impl Send for DDSketch
impl Sync for DDSketch
impl Unpin for DDSketch
impl UnsafeUnpin for DDSketch
impl UnwindSafe for DDSketch
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