tribler.core.restapi.statistics_endpoint

Classes

Socks5StatsDict

Socks5 statistics entry.

LibtorrentSessionStatsDict

Statistics for a single libtorrent session.

LibtorrentStatsDict

Statistics for the entirety of libtorrent.

TriblerStatsDict

Tribler statistics.

StatisticsEndpoint

This endpoint is responsible for handing requests regarding statistics in Tribler.

Module Contents

class tribler.core.restapi.statistics_endpoint.Socks5StatsDict

Bases: TypedDict

Socks5 statistics entry.

hops: int
sessions: int
associates: list[int] | None
class tribler.core.restapi.statistics_endpoint.LibtorrentSessionStatsDict

Bases: TypedDict

Statistics for a single libtorrent session.

recv_bytes: int
sent_bytes: int
dht_recv_bytes: int
dht_sent_bytes: int
tracker_recv_bytes: int
tracker_sent_bytes: int
payload_recv_bytes: int
payload_sent_bytes: int
hops: int
class tribler.core.restapi.statistics_endpoint.LibtorrentStatsDict

Bases: TypedDict

Statistics for the entirety of libtorrent.

sessions: list[LibtorrentSessionStatsDict]
total_recv_bytes: int
total_sent_bytes: int
class tribler.core.restapi.statistics_endpoint.TriblerStatsDict

Bases: TypedDict

Tribler statistics.

peers: NotRequired[int]
db_size: NotRequired[int]
num_torrents: NotRequired[int]
endpoint_version: NotRequired[str | None]
socks5_sessions: NotRequired[list[Socks5StatsDict]]
libtorrent: NotRequired[LibtorrentStatsDict]
class tribler.core.restapi.statistics_endpoint.StatisticsEndpoint(middlewares: tuple = (), client_max_size: int = MAX_REQUEST_SIZE)

Bases: tribler.core.restapi.rest_endpoint.RESTEndpoint

This endpoint is responsible for handing requests regarding statistics in Tribler.

path = '/api/statistics'
session: tribler.core.session.Session | None = None
content_discovery_community: tribler.core.content_discovery.community.ContentDiscoveryCommunity | None = None
get_tribler_stats(_: aiohttp.web.Request) tribler.core.restapi.rest_endpoint.RESTResponse

Return general statistics of Tribler.

get_ipv8_stats(_: aiohttp.web.Request) tribler.core.restapi.rest_endpoint.RESTResponse

Return general statistics of IPv8.

async get_dirspace_stats(request: aiohttp.web.Request) tribler.core.restapi.rest_endpoint.RESTResponse

Return disk space statistics for a given directory.

This method fits the download logic: if the given directory does not exist, the folder is created. So, to account for future folders, this method returns the stats for the first parent folder of the given folder if it does not exist (yet).