Skip to content

Commit 43c7179

Browse files
committed
refactor: [#1543] rename Metrics to ProtocolMetrics
1 parent b0e7443 commit 43c7179

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

packages/axum-rest-tracker-api-server/src/v1/context/stats/resources.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl From<TrackerLabeledMetrics> for LabeledStats {
134134

135135
#[cfg(test)]
136136
mod tests {
137-
use torrust_rest_tracker_api_core::statistics::metrics::{Metrics, TorrentsMetrics};
137+
use torrust_rest_tracker_api_core::statistics::metrics::{ProtocolMetrics, TorrentsMetrics};
138138
use torrust_rest_tracker_api_core::statistics::services::TrackerMetrics;
139139

140140
use super::Stats;
@@ -150,7 +150,7 @@ mod tests {
150150
total_incomplete: 3,
151151
total_torrents: 4
152152
},
153-
protocol_metrics: Metrics {
153+
protocol_metrics: ProtocolMetrics {
154154
// TCP
155155
tcp4_connections_handled: 5,
156156
tcp4_announces_handled: 6,

packages/rest-tracker-api-core/src/statistics/metrics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl From<AggregateActiveSwarmMetadata> for TorrentsMetrics {
3636
/// These metrics are collected for each connection type: UDP and HTTP
3737
/// and also for each IP version used by the peers: IPv4 and IPv6.
3838
#[derive(Debug, PartialEq, Default)]
39-
pub struct Metrics {
39+
pub struct ProtocolMetrics {
4040
/// Total number of TCP (HTTP tracker) connections from IPv4 peers.
4141
/// Since the HTTP tracker spec does not require a handshake, this metric
4242
/// increases for every HTTP request.

packages/rest-tracker-api-core/src/statistics/services.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use torrust_tracker_metrics::metric_collection::MetricCollection;
88
use torrust_udp_tracker_server::statistics as udp_server_statistics;
99

1010
use super::metrics::TorrentsMetrics;
11-
use crate::statistics::metrics::Metrics;
11+
use crate::statistics::metrics::ProtocolMetrics;
1212

1313
/// All the metrics collected by the tracker.
1414
#[derive(Debug, PartialEq)]
@@ -21,7 +21,7 @@ pub struct TrackerMetrics {
2121
/// Application level metrics. Usage statistics/metrics.
2222
///
2323
/// Metrics about how the tracker is been used (number of udp announce requests, number of http scrape requests, etcetera)
24-
pub protocol_metrics: Metrics,
24+
pub protocol_metrics: ProtocolMetrics,
2525
}
2626

2727
/// It returns all the [`TrackerMetrics`]
@@ -56,7 +56,7 @@ async fn get_protocol_metrics(
5656
ban_service: Arc<RwLock<BanService>>,
5757
http_stats_repository: Arc<bittorrent_http_tracker_core::statistics::repository::Repository>,
5858
udp_server_stats_repository: Arc<udp_server_statistics::repository::Repository>,
59-
) -> Metrics {
59+
) -> ProtocolMetrics {
6060
let udp_banned_ips_total = ban_service.read().await.get_banned_ips_total();
6161
let http_stats = http_stats_repository.get_stats().await;
6262
let udp_server_stats = udp_server_stats_repository.get_stats().await;
@@ -66,7 +66,7 @@ async fn get_protocol_metrics(
6666
// tracker, but we keep them for now. In new major versions we should remove
6767
// them.
6868

69-
Metrics {
69+
ProtocolMetrics {
7070
// TCPv4
7171
tcp4_connections_handled: http_stats.tcp4_announces_handled + http_stats.tcp4_scrapes_handled,
7272
tcp4_announces_handled: http_stats.tcp4_announces_handled,
@@ -168,7 +168,7 @@ mod tests {
168168
use torrust_tracker_test_helpers::configuration;
169169
use torrust_tracker_torrent_repository::container::TorrentRepositoryContainer;
170170

171-
use crate::statistics::metrics::{Metrics, TorrentsMetrics};
171+
use crate::statistics::metrics::{ProtocolMetrics, TorrentsMetrics};
172172
use crate::statistics::services::{get_metrics, TrackerMetrics};
173173

174174
pub fn tracker_configuration() -> Configuration {
@@ -214,7 +214,7 @@ mod tests {
214214
tracker_metrics,
215215
TrackerMetrics {
216216
torrents_metrics: TorrentsMetrics::default(),
217-
protocol_metrics: Metrics::default(),
217+
protocol_metrics: ProtocolMetrics::default(),
218218
}
219219
);
220220
}

0 commit comments

Comments
 (0)