Struct cernan::buckets::Buckets[][src]

pub struct Buckets { /* fields omitted */ }

Buckets stores all metrics until they are flushed.

Methods

impl Buckets
[src]

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.

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());

Determine if a bucket has no stored points.

Examples

extern crate cernan;

let bucket = cernan::buckets::Buckets::default();
assert!(bucket.is_empty());

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);

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.

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>

Create an iterator for the bucket. See documentation on buckets::Iter for more details.

Trait Implementations

impl Clone for Buckets
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Default for Buckets
[src]

Create a default Buckets

Examples

use cernan::buckets::Buckets;

let bucket = Buckets::default();
assert_eq!(0, bucket.len());

Auto Trait Implementations

impl Send for Buckets

impl Sync for Buckets