forked from torrust/torrust-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.rs
More file actions
90 lines (76 loc) · 3.75 KB
/
mod.rs
File metadata and controls
90 lines (76 loc) · 3.75 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
pub mod event;
pub mod metrics;
pub mod repository;
pub mod services;
use metrics::Metrics;
use torrust_tracker_metrics::metric::description::MetricDescription;
use torrust_tracker_metrics::metric_name;
use torrust_tracker_metrics::unit::Unit;
pub const UDP_TRACKER_SERVER_REQUESTS_ABORTED_TOTAL: &str = "udp_tracker_server_requests_aborted_total";
pub const UDP_TRACKER_SERVER_REQUESTS_BANNED_TOTAL: &str = "udp_tracker_server_requests_banned_total";
pub const UDP_TRACKER_SERVER_IPS_BANNED_TOTAL: &str = "udp_tracker_server_ips_banned_total";
pub const UDP_TRACKER_SERVER_CONNECTION_ID_ERRORS_TOTAL: &str = "udp_tracker_server_connection_id_errors_total";
pub const UDP_TRACKER_SERVER_REQUESTS_RECEIVED_TOTAL: &str = "udp_tracker_server_requests_received_total";
pub const UDP_TRACKER_SERVER_REQUESTS_ACCEPTED_TOTAL: &str = "udp_tracker_server_requests_accepted_total";
pub const UDP_TRACKER_SERVER_RESPONSES_SENT_TOTAL: &str = "udp_tracker_server_responses_sent_total";
pub const UDP_TRACKER_SERVER_ERRORS_TOTAL: &str = "udp_tracker_server_errors_total";
pub const UDP_TRACKER_SERVER_PERFORMANCE_AVG_PROCESSING_TIME_NS: &str = "udp_tracker_server_performance_avg_processing_time_ns";
pub const UDP_TRACKER_SERVER_PERFORMANCE_AVG_PROCESSED_REQUESTS_TOTAL: &str =
"udp_tracker_server_performance_avg_processed_requests_total";
#[must_use]
pub fn describe_metrics() -> Metrics {
let mut metrics = Metrics::default();
metrics.metric_collection.describe_counter(
&metric_name!(UDP_TRACKER_SERVER_REQUESTS_ABORTED_TOTAL),
Some(Unit::Count),
Some(MetricDescription::new("Total number of UDP requests aborted")),
);
metrics.metric_collection.describe_counter(
&metric_name!(UDP_TRACKER_SERVER_REQUESTS_BANNED_TOTAL),
Some(Unit::Count),
Some(MetricDescription::new("Total number of UDP requests banned")),
);
metrics.metric_collection.describe_gauge(
&metric_name!(UDP_TRACKER_SERVER_IPS_BANNED_TOTAL),
Some(Unit::Count),
Some(MetricDescription::new("Total number of IPs banned from UDP requests")),
);
metrics.metric_collection.describe_counter(
&metric_name!(UDP_TRACKER_SERVER_CONNECTION_ID_ERRORS_TOTAL),
Some(Unit::Count),
Some(MetricDescription::new("Total number of requests with connection ID errors")),
);
metrics.metric_collection.describe_counter(
&metric_name!(UDP_TRACKER_SERVER_REQUESTS_RECEIVED_TOTAL),
Some(Unit::Count),
Some(MetricDescription::new("Total number of UDP requests received")),
);
metrics.metric_collection.describe_counter(
&metric_name!(UDP_TRACKER_SERVER_REQUESTS_ACCEPTED_TOTAL),
Some(Unit::Count),
Some(MetricDescription::new("Total number of UDP requests accepted")),
);
metrics.metric_collection.describe_counter(
&metric_name!(UDP_TRACKER_SERVER_RESPONSES_SENT_TOTAL),
Some(Unit::Count),
Some(MetricDescription::new("Total number of UDP responses sent")),
);
metrics.metric_collection.describe_counter(
&metric_name!(UDP_TRACKER_SERVER_ERRORS_TOTAL),
Some(Unit::Count),
Some(MetricDescription::new("Total number of errors processing UDP requests")),
);
metrics.metric_collection.describe_gauge(
&metric_name!(UDP_TRACKER_SERVER_PERFORMANCE_AVG_PROCESSING_TIME_NS),
Some(Unit::Nanoseconds),
Some(MetricDescription::new("Average time to process a UDP request in nanoseconds")),
);
metrics.metric_collection.describe_counter(
&metric_name!(UDP_TRACKER_SERVER_PERFORMANCE_AVG_PROCESSED_REQUESTS_TOTAL),
Some(Unit::Count),
Some(MetricDescription::new(
"Total number of UDP requests processed for the average performance metrics",
)),
);
metrics
}