Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul stats: add a configuration option to enable/disable stats per server #1402

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/configuration/src/v2_0_0/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ impl Core {
fn default_tracker_policy() -> TrackerPolicy {
TrackerPolicy::default()
}

fn default_tracker_usage_statistics() -> bool {
true
}
Expand Down
9 changes: 9 additions & 0 deletions packages/configuration/src/v2_0_0/http_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@ pub struct HttpTracker {
/// TSL config.
#[serde(default = "HttpTracker::default_tsl_config")]
pub tsl_config: Option<TslConfig>,

/// Weather the tracker should collect statistics about tracker usage.
#[serde(default = "HttpTracker::default_tracker_usage_statistics")]
pub tracker_usage_statistics: bool,
}

impl Default for HttpTracker {
fn default() -> Self {
Self {
bind_address: Self::default_bind_address(),
tsl_config: Self::default_tsl_config(),
tracker_usage_statistics: Self::default_tracker_usage_statistics(),
}
}
}
Expand All @@ -38,4 +43,8 @@ impl HttpTracker {
fn default_tsl_config() -> Option<TslConfig> {
None
}

fn default_tracker_usage_statistics() -> bool {
false
}
}
9 changes: 9 additions & 0 deletions packages/configuration/src/v2_0_0/udp_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ pub struct UdpTracker {
/// the client as the `ConnectionId`.
#[serde(default = "UdpTracker::default_cookie_lifetime")]
pub cookie_lifetime: Duration,

/// Weather the tracker should collect statistics about tracker usage.
#[serde(default = "UdpTracker::default_tracker_usage_statistics")]
pub tracker_usage_statistics: bool,
}
impl Default for UdpTracker {
fn default() -> Self {
Self {
bind_address: Self::default_bind_address(),
cookie_lifetime: Self::default_cookie_lifetime(),
tracker_usage_statistics: Self::default_tracker_usage_statistics(),
}
}
}
Expand All @@ -34,4 +39,8 @@ impl UdpTracker {
fn default_cookie_lifetime() -> Duration {
Duration::from_secs(120)
}

fn default_tracker_usage_statistics() -> bool {
false
}
}
2 changes: 2 additions & 0 deletions packages/test-helpers/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ pub fn ephemeral() -> Configuration {
config.udp_trackers = Some(vec![UdpTracker {
bind_address: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), udp_port),
cookie_lifetime: Duration::from_secs(120),
tracker_usage_statistics: true,
}]);

// Ephemeral socket address for HTTP tracker
let http_port = 0u16;
config.http_trackers = Some(vec![HttpTracker {
bind_address: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), http_port),
tsl_config: None,
tracker_usage_statistics: true,
}]);

let temp_file = ephemeral_sqlite_database();
Expand Down
Loading