relay_metrics/
statsd.rs

1use relay_statsd::{CounterMetric, GaugeMetric};
2
3/// Counter metrics for Relay Metrics.
4pub enum MetricCounters {
5    /// Incremented every time two buckets or two metrics are merged.
6    ///
7    /// This metric is tagged with:
8    ///  - `aggregator`: The name of the metrics aggregator (usually `"default"`).
9    ///  - `namespace`: The namespace of the metric.
10    MergeHit,
11    /// Incremented every time a bucket is created.
12    ///
13    /// This metric is tagged with:
14    ///  - `aggregator`: The name of the metrics aggregator (usually `"default"`).
15    ///  - `namespace`: The namespace of the metric.
16    MergeMiss,
17    /// Incremented for every aggregator flush.
18    ///
19    /// This metric is tagged with:
20    ///  - `aggregator`: The name of the metrics aggregator (usually `"default"`).
21    FlushCount,
22    /// Incremented with the cost of a partition for every aggregator flush.
23    ///
24    /// This metric is tagged with:
25    ///  - `aggregator`: The name of the metrics aggregator (usually `"default"`).
26    ///  - `namespace`: The namespace of the metric.
27    FlushCost,
28}
29
30impl CounterMetric for MetricCounters {
31    fn name(&self) -> &'static str {
32        match *self {
33            Self::MergeHit => "metrics.buckets.merge.hit",
34            Self::MergeMiss => "metrics.buckets.merge.miss",
35            Self::FlushCount => "metrics.buckets.flush.count",
36            Self::FlushCost => "metrics.buckets.flush.cost",
37        }
38    }
39}
40
41/// Gauge metrics for Relay Metrics.
42pub enum MetricGauges {
43    /// The total number of metric buckets in Relay's metrics aggregator.
44    ///
45    /// This metric is tagged with:
46    ///  - `aggregator`: The name of the metrics aggregator (usually `"default"`).
47    ///  - `namespace`: The namespace of the metric.
48    Buckets,
49    /// The total storage cost of metric buckets in Relay's metrics aggregator.
50    ///
51    /// This metric is tagged with:
52    ///  - `aggregator`: The name of the metrics aggregator (usually `"default"`).
53    ///  - `namespace`: The namespace of the metric.
54    BucketsCost,
55}
56
57impl GaugeMetric for MetricGauges {
58    fn name(&self) -> &'static str {
59        match *self {
60            Self::Buckets => "metrics.buckets",
61            Self::BucketsCost => "metrics.buckets.cost",
62        }
63    }
64}