Context
I've added basic metrics to the torrent-repository:
torrent_repository_torrents_total: The total number of torrents.
torrent_repository_torrents_downloads_total: The total number of torrent downloads (since the tracker process started).
torrent_repository_peer_connections_total: The total number of peer connections (one connection per torrent).
My goal is to add new labeled metrics to the metrics API endpoint to include all the metrics we have in the stats API endpoint:
stats endpoint (omitting non-relevant metrics for this issue):
{
"torrents": 0,
"completed": 0,
"seeders": 0,
"leechers": 0
...
}
- The old all
torrents field in the new torrent_repository_torrents_total.
- The fields
seeders and leechers were merged into a single metric torrent_repository_peer_connections_total with a peer_role label. The peer_role values are: seeder and leecher
- The old field
completed is the number of downloads. That is a special one because I'm making some changes. I added the new metric torrent_repository_torrents_downloads_total, but it only counts downloads since the tracker was started. I will add the same metric in the tracker-core package, but the historical value. The reason is that metric requires persistence, and the torrent-repository package only has in-memory data structures. Persistence is handled in the tracker-core. I will implement it by allowing persistent metrics whose initial values are loaded when the tracker starts.
Add more metrics
I want to add more metrics not existing in the current stats endpoint.
- Events metrics: metrics to count how many times an event has happened. For example, how many times has a peer been added, removed, or updated.
- Peer inactivity metrics: a new metric to count how many peers are inactive.
I will open subissues for each of them.
cc @da2ce7
Context
I've added basic metrics to the
torrent-repository:torrent_repository_torrents_total: The total number of torrents.torrent_repository_torrents_downloads_total: The total number of torrent downloads (since the tracker process started).torrent_repository_peer_connections_total: The total number of peer connections (one connection per torrent).My goal is to add new labeled metrics to the
metricsAPI endpoint to include all the metrics we have in thestatsAPI endpoint:statsendpoint (omitting non-relevant metrics for this issue):{ "torrents": 0, "completed": 0, "seeders": 0, "leechers": 0 ... }torrentsfield in the newtorrent_repository_torrents_total.seedersandleecherswere merged into a single metrictorrent_repository_peer_connections_totalwith apeer_rolelabel. Thepeer_rolevalues are:seederandleechercompletedis the number of downloads. That is a special one because I'm making some changes. I added the new metrictorrent_repository_torrents_downloads_total, but it only counts downloads since the tracker was started. I will add the same metric in thetracker-corepackage, but the historical value. The reason is that metric requires persistence, and thetorrent-repositorypackage only has in-memory data structures. Persistence is handled in thetracker-core. I will implement it by allowing persistent metrics whose initial values are loaded when the tracker starts.Add more metrics
I want to add more metrics not existing in the current
statsendpoint.I will open subissues for each of them.
cc @da2ce7