1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//! Internal Dipstick metrics.
//! Collect statistics about various metrics modules at runtime.
//! Stats can can be obtained for publication from `selfstats::SOURCE`.

pub use app_metrics::*;
pub use aggregate::*;
pub use publish::*;
pub use scores::*;
pub use core::*;
pub use namespace::*;

use output::to_void;

// TODO send to_dispatch()
fn build_aggregator() -> Chain<Aggregate> {
    aggregate(summary, to_void())
}

/// Capture a snapshot of Dipstick's internal metrics since the last snapshot.
pub fn snapshot() -> Vec<ScoreSnapshot> {
    vec![]
}

fn build_self_metrics() -> AppMetrics<Aggregate> {
    app_metrics(AGGREGATOR.clone()).with_prefix("dipstick")
}

lazy_static! { static ref AGGREGATOR: Chain<Aggregate> = build_aggregator(); }

/// Application metrics are collected to the aggregator
app_metrics!(Aggregate, DIPSTICK_METRICS = build_self_metrics());