tobbez/deluge_exporter

Pulling a specific metric? (Peer IP's)

Closed this issue · 1 comments

Hey Team!, Love the Deluge exporter. I was curious to know if it is possible to pull the peer IP's from Deluge? I have went through the metrics and tried querying the peer ones however have came up empty handed. Any idea how I could edit the config or what query would be needed to pull this data or if there is a way to test on my own I could try to figure it out.

The exporter currently doesn't expose peer-specific data.

My general sentiment: I wouldn't spend time on implementing this personally, but I would accept a contribution adding it (assuming it was opt-in, like per-torrent metrics).

However, there's a bigger problem here: Deluge doesn't expose any peer data usable for our purposes. Only transfer rates are available (down_speed, up_speed), which are practically useless from a monitoring perspective.

libtorrent does track the required data internally and returns it from peer_connection::get_peer_info (fields total_download, total_upload), but everything except the fields client, country, down_speed, ip, progress, seed, up_speed is discarded by Deluge. Exposing the total_download/total_upload fields would require updating Deluge to keep them (see get_peers in Deluge's deluge/core/torrent.py).

In addition, the total_download/total_upload fields only count payload bytes. Preferably we'd want to also expose the number of protocol bytes. This would require submitting a patch/PR to libtorrent that: 1. adds two new fields to the peer_info struct (e.g. protocol_upload, protocol_download), and 2. sets those fields in peer_connection::get_peer_info.

(This also brings up the question of whether the total_download and total_upload in libtorrent's peer_info should be renamed to match the information they actually contain, so payload_download/payload_upload.)

I'll close this issue for now, but we can revisit it once/if a released version of Deluge exposes the fields libtorrent currently calls total_download/total_upload.