martabal / qbittorrent-exporter

A fast and lightweight prometheus exporter for qBittorrent
MIT License
20 stars 1 forks source link

Missing torrents when cross seeding #83

Closed Phil57 closed 2 days ago

Phil57 commented 2 days ago

Hello,

When doing cross seeding, you have multiple torrents with the same name. The exporter only exports infos for one, as the label is set to Name. I have tested and replaced it by Infohash_v1 and all torrents are exported correcly. This is of course not good because you can't easily know who's who.

Would it be possible to have both the name and the hash, so we can have every torrents, without killing the cardinality ? I believe having both is not a huge deal because these info don't change during the lifetime of the torrent, but maybe I'm wrong.

Thanks

martabal commented 2 days ago

This is something I have never encountered. I don't think adding the hash to the label for the qbittorrent_torrent_* metrics would be an issue for the cardinality. Let's add a new experimental feature for that.

martabal commented 2 days ago

You can add the hash label by setting the ENABLE_LABEL_WITH_HASH env to true

Phil57 commented 2 days ago
`panic: inconsistent label cardinality: expected 2 label values but got 3 in prometheus.Labels{"hash":"3a282xxxxxxx, "name":"ABCD", "tag":"cross-seed"}

goroutine 50 [running]:

github.com/prometheus/client_golang/prometheus.(*GaugeVec).With(...)

    /go/pkg/mod/github.com/prometheus/client_golang@v1.20.5/prometheus/gauge.go:250

qbit-exp/prometheus.Torrent(0xc000190090, 0xc000100eb0)

    /app/prometheus/prometheus.go:137 +0x2fff

qbit-exp/qbit.getData(0xc000100eb0, {{0x8c78ec, 0x15}, {0x8c016e, 0x3}, {0x8c0413, 0x4}, 0x0}, 0x1, 0xc0001027e0)

    /app/qbit/qbit.go:106 +0x4a5

created by qbit-exp/qbit.AllRequests in goroutine 33

    /app/qbit/qbit.go:223 +0x2fa

qbittorrent-exporter (version v1.5.0)`

It's not happy

martabal commented 2 days ago

It's not happy

Should be fixed with v1.5.1

Phil57 commented 2 days ago

It's better. It is now working with ENABLE_LABEL_WITH_HASH set to true, but not to false

panic: inconsistent label cardinality: expected 2 label values but got 3 in prometheus.Labels{"hash":"3a282eded2xxxxxxx", "name":"ABCDEF", "tag":"cross-seed"}

goroutine 28 [running]:

github.com/prometheus/client_golang/prometheus.(*GaugeVec).With(...)

    /go/pkg/mod/github.com/prometheus/client_golang@v1.20.5/prometheus/gauge.go:250

qbit-exp/prometheus.Torrent(0xc0001a2048, 0xc000212140)

    /app/prometheus/prometheus.go:137 +0x2fbf

qbit-exp/qbit.getData(0xc000212140, {{0x8c78ec, 0x15}, {0x8c016e, 0x3}, {0x8c0413, 0x4}, 0x0}, 0x1, 0xc000214460)

    /app/qbit/qbit.go:106 +0x4a5

created by qbit-exp/qbit.AllRequests in goroutine 25

    /app/qbit/qbit.go:223 +0x2fa

qbittorrent-exporter (version v1.5.1)
martabal commented 2 days ago

It's better. It is now working with ENABLE_LABEL_WITH_HASH set to true, but not to false

Should be fixed :sweat:

Phil57 commented 2 days ago

Seems ok now. I'll test it with true for the next few days.

I can confirm that for now I have now all my torrents listed. Thank you very much.