relay_metrics/statsd.rs
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
use relay_statsd::{CounterMetric, GaugeMetric};
/// Counter metrics for Relay Metrics.
pub enum MetricCounters {
/// Incremented every time two buckets or two metrics are merged.
///
/// This metric is tagged with:
/// - `aggregator`: The name of the metrics aggregator (usually `"default"`).
/// - `namespace`: The namespace of the metric.
MergeHit,
/// Incremented every time a bucket is created.
///
/// This metric is tagged with:
/// - `aggregator`: The name of the metrics aggregator (usually `"default"`).
/// - `namespace`: The namespace of the metric.
MergeMiss,
/// Incremented for every aggregator flush.
///
/// This metric is tagged with:
/// - `aggregator`: The name of the metrics aggregator (usually `"default"`).
FlushCount,
/// Incremented with the cost of a partition for every aggregator flush.
///
/// This metric is tagged with:
/// - `aggregator`: The name of the metrics aggregator (usually `"default"`).
/// - `namespace`: The namespace of the metric.
FlushCost,
}
impl CounterMetric for MetricCounters {
fn name(&self) -> &'static str {
match *self {
Self::MergeHit => "metrics.buckets.merge.hit",
Self::MergeMiss => "metrics.buckets.merge.miss",
Self::FlushCount => "metrics.buckets.flush.count",
Self::FlushCost => "metrics.buckets.flush.cost",
}
}
}
/// Gauge metrics for Relay Metrics.
pub enum MetricGauges {
/// The total number of metric buckets in Relay's metrics aggregator.
///
/// This metric is tagged with:
/// - `aggregator`: The name of the metrics aggregator (usually `"default"`).
/// - `namespace`: The namespace of the metric.
Buckets,
/// The total storage cost of metric buckets in Relay's metrics aggregator.
///
/// This metric is tagged with:
/// - `aggregator`: The name of the metrics aggregator (usually `"default"`).
/// - `namespace`: The namespace of the metric.
BucketsCost,
}
impl GaugeMetric for MetricGauges {
fn name(&self) -> &'static str {
match *self {
Self::Buckets => "metrics.buckets",
Self::BucketsCost => "metrics.buckets.cost",
}
}
}