-
Notifications
You must be signed in to change notification settings - Fork 49
Overhaul stats: Allow removing peerless torrents without affecting global torrent downloads metric #1545
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
Merged
josecelano
merged 8 commits into
torrust:develop
from
josecelano:1543-overhaul-stats-allow-removing-peerless-torrents-without-affecting-global-torrent-downloads-metric
May 28, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…tiveSwarmMetadata Aggregate values are only for active swarms. For example, it does not count downloads for torrents that are not currently active.
We need to load the number of downloads for the torrent before adding it to the active swarms becuase the scrape response includes the number of downloads, and that number should included all downloads ever.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1545 +/- ##
===========================================
+ Coverage 83.34% 83.46% +0.11%
===========================================
Files 274 275 +1
Lines 19547 19601 +54
Branches 19547 19601 +54
===========================================
+ Hits 16292 16360 +68
+ Misses 2965 2948 -17
- Partials 290 293 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
… from DB if not needed
It now returns the persisted value when available (stats persistence enabled).
…acker-core
The tracker-core always has the metric alhoutght it can be persisted or
not. When it's not persisted, it contains the number of downloads during
the session.
On the other hand, the `torrent-repository` metri uses labels, so you
have to sum all values for all labels to get the total.
```
torrent_repository_torrents_downloads_total{peer_role="seeder"} 1
tracker_core_persistent_torrents_downloads_total{} 1
```
… tracker policy There were not being removed when stats was enabled becuase the tracker was counting downloads only from the active swarms. Now the API exposed metric (global downldoads) is not taken from the in-memory data structrure unless stats persistence is disabled. In that case, the global total would be per session (since the tracker started), and reset when the tracker restarts.
Member
Author
|
ACK 92242f8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Subtasks
After merging this PR, the tracker will save memory because peerless torrents will be removed from memory (when that policy is enabled) even when stats is enabled.