[][src]Module stats::prelude

A "prelude" of stats crate.

This prelude is similar to the standard library's prelude in that you'll almost always want to import its entire contents, but unlike the standard library's prelude you'll have to do so manually:

use stats::prelude::*;

Macros

define_stats

The macro to define STATS module that contains static variables, one per counter you want to export. This is the main and recomended way to interact with statistics provided by this crate. If non empty prefix is passed then the exported counter name will be "{prefix}.{name}"

define_stats_struct

Define a group of stats with dynamic names all parameterized by the same set of parameters. The intention is that when setting up a structure for some entity with associated stats, then the type produced by this macro can be included in that structure, and initialized with the appropriate name(s). This is more efficient than using single static "dynamic_" versions of the counters.

Traits

Counter

Counter is the simplest type of aggregated stat, it behaves as a single number that can be incremented.

CounterStatic
DynamicCounter

Similar to the Counter trait, but accepts the args parameter for accessing dynamic counters created at runtime.

DynamicHistogram

Similar to the Histogram trait, but accepts the args parameter for accessing dynamic histograms created at runtime.

DynamicSingletonCounter

Similar to the SingletonCounter trait, but accepts the args parameter for accessing dynamic histograms created at runtime.

DynamicTimeseries

Similar to Timeseries trait, but accepts the args parameter for accessing dynamic timeseries created in runtime.

Histogram

Histogram is a type of stat that can aggregate data send to it into predefined buckets. Example aggregations are average, sum or P50 (percentile). The aggregation should also happen on an interval basis, since its rarely useful to see aggregated all-time stats of a service running for many days.

HistogramStatic
Timeseries

Timeseries is a type of stat that can aggregate data send to it into predefined intervals of time. Example aggregations are average, sum or rate.

TimeseriesStatic