Struct cernan::buckets::Buckets [−][src]
pub struct Buckets { /* fields omitted */ }
Buckets stores all metrics until they are flushed.
Methods
impl Buckets
[src]
impl Buckets
pub fn new(bin_width: i64) -> Buckets
[src]
pub fn new(bin_width: i64) -> Buckets
Create a new bucket. The bin_width
controls the aggregation width of
the bucket. If bin_width
is set to N then two Telemetry
will be
considered as happening at the 'same' time if their timestamps are
within N seconds of one another.
pub fn reset(&mut self)
[src]
pub fn reset(&mut self)
Resets appropriate aggregates
Examples
extern crate cernan; let metric = cernan::metric::Telemetry::new() .name("foo") .value(1.0) .kind(cernan::metric::AggregationMethod::Sum) .harden() .unwrap(); let mut buckets = cernan::buckets::Buckets::default(); assert_eq!(true, buckets.is_empty()); buckets.add(metric); assert_eq!(false, buckets.is_empty()); //buckets.reset(); //assert_eq!(true, buckets.is_empty());
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Determine if a bucket has no stored points.
Examples
extern crate cernan; let bucket = cernan::buckets::Buckets::default(); assert!(bucket.is_empty());
pub fn add(&mut self, value: Telemetry)
[src]
pub fn add(&mut self, value: Telemetry)
Adds a metric to the bucket storage.
Examples
extern crate cernan; let metric = cernan::metric::Telemetry::new() .name("foo") .value(1.0) .kind(cernan::metric::AggregationMethod::Sum) .harden() .unwrap(); let mut bucket = cernan::buckets::Buckets::default(); bucket.add(metric);
pub fn count(&self) -> usize
[src]
pub fn count(&self) -> usize
Determine the number of Telemetry
stored in the bucket.
This function returns the total number of Telemetry
stored in the
bucket. This is distinct from the value returned by Buckets::len
which
measures the total number of Telemetry
names received by the bucket.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Determine the number of Telemetry
names stored in the bucket.
This function returns the total number of Telemetry
names stored in
the bucket. This is distinct from the value returned by Buckets::count
which measures the total number of Telemetry
received by the bucket.
ⓘImportant traits for Iter<'a>pub fn iter(&mut self) -> Iter
[src]
pub fn iter(&mut self) -> Iter
Create an iterator for the bucket. See documentation on buckets::Iter
for more details.
Trait Implementations
impl Clone for Buckets
[src]
impl Clone for Buckets
fn clone(&self) -> Buckets
[src]
fn clone(&self) -> Buckets
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for Buckets
[src]
impl Default for Buckets