From 797133b28e05e9730c738d9fd8e452fbbda63828 Mon Sep 17 00:00:00 2001 From: Erich Blume Date: Thu, 5 Mar 2026 08:01:37 -0800 Subject: [PATCH] Fix per-torrent rate panels showing cumulative bytes instead of rates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dashboard "Download/Upload Rate by Torrent" panels were querying transmission_torrent_download_bytes (total_size * percent_done) and transmission_torrent_upload_bytes (uploaded_ever) — cumulative byte gauges, not rates. Added new metrics using Transmission's native rate_download/rate_upload and updated dashboard queries. Co-Authored-By: Claude Opus 4.6 --- .../dashboards/configmap-transmission.yaml | 4 ++-- containers/transmission-exporter/exporter.py | 14 ++++++++++++++ .../+transmission-rate-metrics.bugfix.md | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 docs/changelog.d/+transmission-rate-metrics.bugfix.md diff --git a/argocd/manifests/grafana-config/dashboards/configmap-transmission.yaml b/argocd/manifests/grafana-config/dashboards/configmap-transmission.yaml index d380fc3..ac99ed1 100644 --- a/argocd/manifests/grafana-config/dashboards/configmap-transmission.yaml +++ b/argocd/manifests/grafana-config/dashboards/configmap-transmission.yaml @@ -378,7 +378,7 @@ data: "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, - "expr": "transmission_torrent_download_bytes > 0", + "expr": "transmission_torrent_download_rate_bytes > 0", "legendFormat": "{{name}}", "refId": "A" } @@ -435,7 +435,7 @@ data: "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, - "expr": "transmission_torrent_upload_bytes > 0", + "expr": "transmission_torrent_upload_rate_bytes > 0", "legendFormat": "{{name}}", "refId": "A" } diff --git a/containers/transmission-exporter/exporter.py b/containers/transmission-exporter/exporter.py index bde1034..e7f08a8 100644 --- a/containers/transmission-exporter/exporter.py +++ b/containers/transmission-exporter/exporter.py @@ -107,6 +107,16 @@ class TransmissionCollector: "Torrent total uploaded ever in bytes", labels=["name"], ) + t_download_rate = GaugeMetricFamily( + "transmission_torrent_download_rate_bytes", + "Torrent current download rate in bytes/s", + labels=["name"], + ) + t_upload_rate = GaugeMetricFamily( + "transmission_torrent_upload_rate_bytes", + "Torrent current upload rate in bytes/s", + labels=["name"], + ) t_done = GaugeMetricFamily( "transmission_torrent_done", "Torrent percent done (0.0-1.0)", @@ -117,12 +127,16 @@ class TransmissionCollector: name = t.name or "unknown" t_download.add_metric([name], t.total_size * t.percent_done) t_upload.add_metric([name], t.uploaded_ever) + t_download_rate.add_metric([name], t.rate_download) + t_upload_rate.add_metric([name], t.rate_upload) t_ratio.add_metric([name], t.ratio) t_uploaded_ever.add_metric([name], t.uploaded_ever) t_done.add_metric([name], t.percent_done) yield t_download yield t_upload + yield t_download_rate + yield t_upload_rate yield t_ratio yield t_uploaded_ever yield t_done diff --git a/docs/changelog.d/+transmission-rate-metrics.bugfix.md b/docs/changelog.d/+transmission-rate-metrics.bugfix.md new file mode 100644 index 0000000..fb8862c --- /dev/null +++ b/docs/changelog.d/+transmission-rate-metrics.bugfix.md @@ -0,0 +1 @@ +Add per-torrent rate metrics using Transmission's native rate_download/rate_upload fields. Dashboard panels were querying cumulative byte gauges (torrent size) instead of actual transfer rates.