qbittorrent-exporter icon indicating copy to clipboard operation
qbittorrent-exporter copied to clipboard

Migrate to quarkus and add locale setting

Open vincejv opened this issue 1 year ago • 8 comments

Fixes: https://github.com/caseyscarborough/qbittorrent-exporter/issues/19 & https://github.com/caseyscarborough/qbittorrent-exporter/issues/15

Locale setting is defined in Environment variable: QBITTORRENT_LOCALE, defaults to en-US, uses IETF BCP 47 language tag (also see RFC 4647 "Matching of Language Tags" and RFC 5646 "Tags for Identifying Languages").

To review:

  • [ ] Implications in using quarkus and compiling to native code
  • [ ] Documentation update for environment variable

vincejv avatar Oct 30 '23 02:10 vincejv

Seems like #15 is not completely fixed, at least not on my end. Changed locale to nl-NL to match qBit but the resulting values simply remove the comma entirely (e.g. 10,90 becomes 1090). Same thing seems to happen with fr-FR, which you recommended in the issue.

Quinten0508 avatar Nov 03 '23 22:11 Quinten0508

Hello @Quinten0508 , appreciate your effort for testing it! Can you also check and/or provide screenshot if the value for Global Ratio reflects the same in prometheus when querying it with promql directly? Grafana or Prometheus screenshot will do, see below for example, or can also call on the exporter's /metrics endpoint directly and provide the output here.

~I have a suspicion that some parts like individual torrent ratios are still not fixed~ this seems to be not the issue, just wanted to check if at least the Global ratio is fixed. Will push updates on this PR if it seems to be the issue

image image

vincejv avatar Nov 04 '23 00:11 vincejv

Can confirm, global ratio is also wrong within Prometheus. Real share ratio should be 10,90 (or 10.90). Same goes for the /metrics endpoint. In the second screenshot you can see it does add a decimal dot, just not in the right spot (1090.0 instead of 10.90) image image

Quinten0508 avatar Nov 04 '23 14:11 Quinten0508

Might be worth noting that within the docker container's logs, the following error keeps showing up every time it scrapes new data: 2023-11-04 14:48:18,858 WARN [qbi.api.gso.LongTypeAdapter] (executor-thread-1) Could not read long None which had an invalid long value. Defaulting value to 0. Not sure if this has to do with the global ratio conversion or if it's completely unrelated. Setting the env variable LOG_LEVEL=DEBUG does not do anything.

Quinten0508 avatar Nov 04 '23 14:11 Quinten0508

I've opened an issue with the upstream framework, might be an issue caused by Quarkus/GraalVM native. This might be caused by upstream not by the code itself. https://github.com/quarkusio/quarkus/issues/36876

vincejv avatar Nov 05 '23 03:11 vincejv

Hi @Quinten0508 I've made some workarounds to issues with the framework, please pull the latest image (vincejv/qbittorrent-exporter), I personally tested it on my end as well by manually changing the locales. Thanks.

vincejv avatar Nov 06 '23 16:11 vincejv

Just pulled the latest image and it seems to be working now! Thanks :D

image image

Quinten0508 avatar Nov 08 '23 08:11 Quinten0508

Holding off as draft until Quarkus ~3.7~ 3.8, which is an LTS release. But this PR has been stable so far after 3 months of usage, no OOM crashes or errors, no regressions in correctness/performance. Resource usage is consistent on earlier posts, 20-50mb RAM idle compared to pure JVM.

vincejv avatar Jan 23 '24 03:01 vincejv