[][src]Crate stats

Provides a macro define_stats! for creation of stats. This crate requires the caller to schedule aggregation of stats by calling schedule_stats_aggregation and executing the returned future.

Re-exports

pub use self::thread_local_aggregator::schedule_stats_aggregation;
pub use self::thread_local_aggregator::schedule_stats_aggregation_preview;

Modules

prelude

A "prelude" of stats crate.

thread_local_aggregator

This module provides the means to define stats that are thread local and to schedule a periodic aggregation process of those stats.

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.

Functions

register_stats_manager_factory

This function must be called exactly once before accessing any of the stats, otherwise it will panic. If it won't be called a default stats manager factory will be assumed that does nothing. (Facebook only: the default will use fb303 counters)