qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
27.77k stars 3.92k forks source link

New WebAPI endpoint for statistics #12201

Open FranciscoPombal opened 4 years ago

FranciscoPombal commented 4 years ago

Please provide the following information

qBittorrent version and Operating System

Any

If on linux, libtorrent-rasterbar and Qt version

N/A

What is the problem

It would be useful to be able to request statistics via the WebAPI. Currently, the only way to get statistics is to request sync/maindata, which is wasteful since it comes with a lot of additional data.

What is the expected behavior

There should be an API endpoint to request statistics.

Steps to reproduce

N/A

Extra info(if any)

N/A

FranciscoPombal commented 4 years ago

The WebUI should continue to get the statistics from the sync/maindata, as there is no advantage to requesting them from this endpoint.

CameronGarrett commented 5 months ago

I have a use case for this - I use the Homepage app to monitor self hosted services including qBittorrent. The Homepage widget can poll the qBittorrent API at intervals for general stats (number leeching, download speed, number seeding, upload speed). I believe Homepage has to use the /torrents/info endpoint for this and for those with a large number of torrents the response becomes very bloated and can result in instability. Please correct me if I missed something in the API docs but I think this would be a useful features for a bunch of selfhosted monitoring solutions that are becoming popular these days. This is the warning I see repeatedly in logs:

warn: API response for /api/services/proxy?type=qbittorrent&group=SomeBox&service=qBittorrent&endpoint=torrents%2Finfo exceeds 4MB. API Routes are meant to respond quickly. https://nextjs.org/docs/messages/api-routes-response-size-limit