Skip to content

Conversation

@josecelano
Copy link
Member

@josecelano josecelano commented May 20, 2025

This adds two new metrics:

  • torrent_repository_inactive_peers_total: The number of inactive peers across all torrents.
  • torrent_repository_inactive_torrents_total: The number of inactive torrents (inactive swarms).

The metric is added to the `torrent-repository` package.

The metric in Prometheus format:

```
torrent_repository_peers_inactive_total{} 0
```

It was not included as a new label in the number of peers because it can't be calculated from current events.

New inactivity events could have been added but the solution was much
more complex than this and having two metrics counting peers is not so
bad.

The discarded alternative was addinga new label por satte (`active`,
`inactive`).
@codecov
Copy link

codecov bot commented May 20, 2025

Codecov Report

Attention: Patch coverage is 42.26190% with 97 lines in your changes missing coverage. Please review.

Project coverage is 83.92%. Comparing base (fbefc88) to head (677deac).
Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
...ository/src/statistics/activity_metrics_updater.rs 13.20% 46 Missing ⚠️
packages/torrent-repository/src/swarms.rs 42.10% 22 Missing ⚠️
...es/torrent-repository/src/statistics/repository.rs 0.00% 15 Missing ⚠️
packages/torrent-repository/src/swarm.rs 55.17% 13 Missing ⚠️
src/app.rs 90.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1530      +/-   ##
===========================================
- Coverage    84.35%   83.92%   -0.43%     
===========================================
  Files          265      267       +2     
  Lines        19043    19207     +164     
  Branches     19043    19207     +164     
===========================================
+ Hits         16063    16120      +57     
- Misses        2702     2811     +109     
+ Partials       278      276       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@josecelano josecelano marked this pull request as ready for review May 21, 2025 11:34
@josecelano josecelano force-pushed the 1523-overhaul-stats-add-peer-inactivity-metrics-to-torrent-repository-package branch from f3056ef to 677deac Compare May 21, 2025 11:54
@josecelano
Copy link
Member Author

ACK 677deac

@josecelano josecelano merged commit 93f851d into torrust:develop May 21, 2025
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overhaul stats: add peer inactivity metrics to torrent-repository package

1 participant