relay_system/statsd.rs
1use relay_statsd::GaugeMetric;
2
3/// Gauge metrics for Relay system components.
4pub enum SystemGauges {
5 /// Number of active runtime tasks.
6 ///
7 /// Every call to [`spawn`](`crate::spawn()`) increases this counter by one,
8 /// and decrements the counter by one on termination.
9 ///
10 /// This metric is tagged with:
11 /// - `id`: A unique identifier for the task, derived from its location in code.
12 /// - `file`: The source filename where the task is created.
13 /// - `line`: The source line where the task is created within the file.
14 RuntimeTaskCount,
15 /// A number of messages queued in a services inbound message channel.
16 ///
17 /// This metric is emitted once per second for every running service. Without backlogs, this
18 /// number should be close to `0`. If this number is monotonically increasing, the service is
19 /// not able to process the inbound message volume.
20 ///
21 /// This metric is tagged with:
22 /// - `service`: The fully qualified type name of the service implementation.
23 ServiceBackPressure,
24 /// Number of messages currently being handled concurrently by a [`ConcurrentService`](crate::ConcurrentService).
25 /// This metric is tagged with:
26 /// - `service`: The fully qualified type name of the service implementation.
27 ServiceConcurrency,
28}
29
30impl GaugeMetric for SystemGauges {
31 fn name(&self) -> &'static str {
32 match *self {
33 Self::RuntimeTaskCount => "runtime.tasks",
34 Self::ServiceBackPressure => "service.back_pressure",
35 Self::ServiceConcurrency => "service.concurrency",
36 }
37 }
38}