Struct prometrics::metrics::Counter [] [src]

pub struct Counter(_);

Counter is a cumulative metric that represents a single numerical value that only ever goes up.

Cloned counters share the same value.

Examples

use prometrics::metrics::CounterBuilder;

let mut counter = CounterBuilder::new("foo_total").namespace("example").finish().unwrap();
assert_eq!(counter.metric_name().to_string(), "example_foo_total");
assert_eq!(counter.value(), 0.0);

counter.increment();
assert_eq!(counter.value(), 1.0);

Methods

impl Counter
[src]

[src]

Makes a new Counter instance.

Note that it is recommended to create this via CounterBuilder.

[src]

Returns the name of this counter.

[src]

Returns the help of this counter.

[src]

Returns the labels of this counter.

[src]

Returns the mutable labels of this counter.

[src]

Returns the timestamp of this counter.

[src]

Returns the mutable timestamp of this counter.

[src]

Returns the value of this counter.

[src]

Increments this counter.

[src]

Adds count to this counter.

[src]

Adds count to this counter.

[src]

Measures the exeuction time of f and adds its duration to the counter in seconds.

[src]

Returns a collector for this counter.

Trait Implementations

impl From<Counter> for Metric
[src]

[src]

Performs the conversion.

impl Debug for Counter
[src]

[src]

Formats the value using the given formatter. Read more

impl Clone for Counter
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Display for Counter
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Counter

impl Sync for Counter