Skip to content

Add new config options to enable/disable stats for UDP and HTTP trackers. #1263

@josecelano

Description

While I was reviewing the tracker-core package documentation I've realized we have the tracker_usage_statistics config option in the core configuration:

[core]
tracker_usage_statistics = true

That value enables or disables the statistics.

I've recently moved the statistics out of the tracker core package. Therefore It does not make sense to have that config option there because there is nothing related to statistics tin the tracker-core package now.

That value is used in the app bootstrap:

// HTTP stats
let (http_stats_event_sender, http_stats_repository) =
    http_tracker_core::statistics::setup::factory(configuration.core.tracker_usage_statistics);
let http_stats_event_sender = Arc::new(http_stats_event_sender);
let http_stats_repository = Arc::new(http_stats_repository);

// UDP stats
let (udp_stats_event_sender, udp_stats_repository) =
    udp_tracker_core::statistics::setup::factory(configuration.core.tracker_usage_statistics);
let udp_stats_event_sender = Arc::new(udp_stats_event_sender);
let udp_stats_repository = Arc::new(udp_stats_repository);

The same config option enables stats in both the UDP and HTTP trackers.

The current config omitting irrelevant values:

[core]
tracker_usage_statistics = true

[[udp_trackers]]
bind_address = "0.0.0.0:6969"

  [udp_trackers.cookie_lifetime]
  secs = 120
  nanos = 0

[[http_trackers]]
bind_address = "0.0.0.0:7070"

[http_api]
bind_address = "0.0.0.0:1212"

  [http_api.access_tokens]
  admin = "***"

[health_check_api]
bind_address = "127.0.0.1:1313"

Maybe we should create two new values for UDP and HTTP trackers. However in the current configuration there is not a place to put generic configuration for all HTTP trackers or all UDP trackers.

We can only add a config option per instance.

NOTE: That you can run more than one HTTP and/or UDP trackers.

If we do that the config could be:

[core]
tracker_usage_statistics = true

[[udp_trackers]]
bind_address = "0.0.0.0:6969"
tracker_usage_statistics = true

  [udp_trackers.cookie_lifetime]
  secs = 120
  nanos = 0

[[http_trackers]]
bind_address = "0.0.0.0:7070"
tracker_usage_statistics = true

[http_api]
bind_address = "0.0.0.0:1212"

  [http_api.access_tokens]
  admin = "***"

[health_check_api]
bind_address = "127.0.0.1:1313"

Where you can enable/disable stats for each instance.

cc @da2ce7

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions