Skip to main content

Module stats

Module stats 

Source
Expand description

Session statistics metric registry and atomic counter array.

Provides 99 atomic metrics across 8 categories (network, disk, DHT, peers, protocol, bandwidth, session, operational diagnostics). MetricKind distinguishes monotonic counters from point-in-time gauges. SessionStatsMetric provides static metadata for each metric, and SessionCounters holds the atomic values.

Structs§

SessionCounters
Atomic counter array shared between session and torrent actors.
SessionStatsMetric
Static metadata for a single session metric.

Enums§

MetricKind
Whether a metric is a monotonically increasing counter or a point-in-time gauge.

Constants§

BW_DOWNLOAD_RATE
Metric index: current aggregate download rate in bytes/sec (gauge).
BW_DOWNLOAD_RATE_TCP
Metric index: current TCP download rate in bytes/sec (gauge).
BW_DOWNLOAD_RATE_UTP
Metric index: current uTP download rate in bytes/sec (gauge).
BW_PAYLOAD_DOWNLOAD_RATE
Metric index: current payload-only download rate in bytes/sec (gauge).
BW_PAYLOAD_UPLOAD_RATE
Metric index: current payload-only upload rate in bytes/sec (gauge).
BW_TOTAL_DOWNLOADED
Metric index: total bytes downloaded since session start (counter).
BW_TOTAL_UPLOADED
Metric index: total bytes uploaded since session start (counter).
BW_UPLOAD_RATE
Metric index: current aggregate upload rate in bytes/sec (gauge).
BW_UPLOAD_RATE_TCP
Metric index: current TCP upload rate in bytes/sec (gauge).
BW_UPLOAD_RATE_UTP
Metric index: current uTP upload rate in bytes/sec (gauge).
CHOKE_ROTATION_EVICTIONS_TOTAL
Metric index: total choke-rotation evictions (counter).
CONNECT_FAILURES_TOTAL
Metric index: total TCP/uTP connect failures before BT handshake (counter).
DATA_TIMEOUT_EVICTIONS_TOTAL
Metric index: total data-contribution timeout evictions (counter).
DHT_ANNOUNCE_COUNT
Metric index: total DHT announce operations (counter).
DHT_BYTES_IN
Metric index: total bytes received via DHT (counter).
DHT_BYTES_OUT
Metric index: total bytes sent via DHT (counter).
DHT_LOOKUPS
Metric index: total DHT lookup operations (counter).
DHT_NODES
Metric index: current number of DHT routing table nodes (gauge).
DHT_NODES_V4
Metric index: current number of IPv4 DHT nodes (gauge).
DHT_NODES_V6
Metric index: current number of IPv6 DHT nodes (gauge).
DIAGNOSTIC_COUNTERS_START
First diagnostic counter index. Counters at or above this index are only incremented when SessionCounters::diagnostics is enabled.
DISK_CACHE_HITS
Metric index: total disk cache hits (counter).
DISK_CACHE_MISSES
Metric index: total disk cache misses (counter).
DISK_HASH_COUNT
Metric index: total piece hash operations (counter).
DISK_JOB_TIME_US
Metric index: cumulative disk job time in microseconds (counter).
DISK_QUEUE_DEPTH
Metric index: current disk job queue depth (gauge).
DISK_READ_BYTES
Metric index: total bytes read from disk (counter).
DISK_READ_COUNT
Metric index: total disk read operations (counter).
DISK_WRITE_BUFFER_BYTES
Metric index: current write buffer size in bytes (gauge).
DISK_WRITE_BYTES
Metric index: total bytes written to disk (counter).
DISK_WRITE_COUNT
Metric index: total disk write operations (counter).
DISPATCH_ACQUIRE_NONE_TOTAL
Metric index: total AcquirePiece requests returning NoneAvailable (counter).
DISPATCH_ACQUIRE_RTT_US
Metric index: cumulative AcquirePiece round-trip microseconds (counter).
DISPATCH_ACQUIRE_TOTAL
Metric index: total AcquirePiece requests handled (counter).
DISPATCH_ACQUIRE_US
Metric index: cumulative microseconds spent in AcquirePiece handling (counter).
DISPATCH_CURSOR_RESUMED
Metric index: acquire_piece calls where the per-peer cursor started from a non-zero position, indicating the walk resumed from a previous call rather than scanning from the front of order_map.order (counter).
DISPATCH_NOTIFY_WAIT_US
Metric index: cumulative microseconds peers spent waiting on piece_notify (counter).
DISPATCH_NOTIFY_WAKEUP_TOTAL
Metric index: total reservation_notify wakeups fired (counter).
DISPATCH_PEER_CONNECT_TOTAL
Metric index: total peer connections completing handshake (counter).
DISPATCH_PEER_DISCONNECT_TOTAL
Metric index: total peer disconnections (counter).
DISPATCH_TICK_WAKE_SKIPPED
Metric index: pipeline-tick wakes that were skipped because the dispatch state (queue size + in-flight count) was unchanged since the previous tick (counter). High values relative to DISPATCH_NOTIFY_WAKEUP_TOTAL indicate the state-gated tick is working — peers are not being spuriously woken when nothing has changed since the last tick.
DISPATCH_TX_HIGH_WATER
Metric index: peer dispatch-channel max queue depth (M182 surface; gauge).
DISPATCH_WALK_SKIPPED
Metric index: acquire_piece calls whose Phase 2 linear walk over order_map.order was short-circuited because the peer’s bitfield does not intersect queue_pieces (counter). Ratio against DISPATCH_ACQUIRE_TOTAL reveals how often peers ask for work they have no eligible piece for — the bitfield-intersection guard short- circuits these in O(num_pieces / 8) bytes instead of O(num_pieces).
EVENT_TX_HIGH_WATER
Metric index: peer event-channel max queue depth (M182 surface; gauge).
FIRST_BLOCK_LATENCY_COUNT
Number of first-block-after-unchoke measurements (counter).
FIRST_BLOCK_LATENCY_SUM_US
Cumulative microseconds from remote-unchoke to first Piece block received (counter). Divide by FIRST_BLOCK_LATENCY_COUNT for mean unchoke-to-first-block latency.
NET_BYTES_RECV
Metric index: total bytes received across all connections (counter).
NET_BYTES_SENT
Metric index: total bytes sent across all connections (counter).
NET_NUM_CONNECTIONS
Metric index: current number of established connections (gauge).
NET_NUM_HALF_OPEN
Metric index: current number of half-open (connecting) sockets (gauge).
NET_NUM_TCP_CONNECTIONS
Metric index: current number of TCP connections (gauge).
NET_NUM_TCP_PEERS
Metric index: current number of TCP peers (gauge).
NET_NUM_UTP_CONNECTIONS
Metric index: current number of uTP connections (gauge).
NET_NUM_UTP_PEERS
Metric index: current number of uTP peers (gauge).
NET_TCP_BYTES_RECV
Metric index: total bytes received over TCP (counter).
NET_TCP_BYTES_SENT
Metric index: total bytes sent over TCP (counter).
NET_UTP_BYTES_RECV
Metric index: total bytes received over uTP (counter).
NET_UTP_BYTES_SENT
Metric index: total bytes sent over uTP (counter).
NUM_METRICS
Total number of metrics tracked by the session.
PEER_DRAIN_ITEMS_TOTAL
Metric index: total items drained from peer backpressure queues (counter).
PEER_LIFETIME_COUNT
Number of peer disconnects contributing to PEER_LIFETIME_SUM_MS (counter).
PEER_LIFETIME_SUM_MS
Cumulative milliseconds of peer connection lifetime at disconnect (counter). Divide by PEER_LIFETIME_COUNT for mean connection duration.
PEER_NUM_BANNED
Metric index: current number of banned peers (gauge).
PEER_NUM_CHECKING_TORRENTS
Metric index: current number of torrents being checked (gauge).
PEER_NUM_DOWNLOADING
Metric index: current number of peers we are downloading from (gauge).
PEER_NUM_DOWNLOADING_TORRENTS
Metric index: current number of torrents in downloading state (gauge).
PEER_NUM_INTERESTED
Metric index: current number of interested peers (gauge).
PEER_NUM_PAUSED_TORRENTS
Metric index: current number of paused torrents (gauge).
PEER_NUM_SEEDING_TORRENTS
Metric index: current number of torrents in seeding state (gauge).
PEER_NUM_UNCHOKED
Metric index: current number of unchoked peers (gauge).
PEER_NUM_UPLOADING
Metric index: current number of peers we are uploading to (gauge).
PEER_NUM_WEB_SEEDS
Metric index: current number of active web seeds (gauge).
PEER_PEERS_AVAILABLE
Metric index: current total number of known available peers (gauge).
PEER_PEERS_CONNECTED
Metric index: current total number of connected peers (gauge).
PEER_WAKE_EVENTS_TOTAL
Metric index: total drain-notify arm fires (counter).
PIECE_STEALS_TOTAL
Metric index: total piece-level steals from slow peers (counter).
PROTO_HANDSHAKES_IN
Metric index: total incoming handshakes received (counter).
PROTO_HANDSHAKES_OUT
Metric index: total outgoing handshakes sent (counter).
PROTO_HASHFAILS
Metric index: total piece hash verification failures (counter).
PROTO_METADATA_RECEIVES
Metric index: total BEP 9 metadata pieces received (counter).
PROTO_METADATA_REQUESTS
Metric index: total BEP 9 metadata requests sent (counter).
PROTO_PEX_MESSAGES_IN
Metric index: total PEX messages received (counter).
PROTO_PEX_MESSAGES_OUT
Metric index: total PEX messages sent (counter).
PROTO_PIECES_DOWNLOADED
Metric index: total pieces downloaded across all torrents (counter).
PROTO_PIECES_UPLOADED
Metric index: total pieces uploaded across all torrents (counter).
PROTO_PIECE_REJECTS
Metric index: total piece reject messages received (counter).
PROTO_PIECE_REQUESTS
Metric index: total piece request messages sent (counter).
PROTO_TRACKER_ANNOUNCES
Metric index: total tracker announce requests (counter).
PROTO_TRACKER_ERRORS
Metric index: total tracker announce errors (counter).
PROTO_WASTE_BYTES
Metric index: total wasted bytes (duplicate/rejected data) (counter).
REMOTE_RECHOKE_TOTAL
Times a remote peer re-choked us after having unchoked (counter).
REMOTE_UNCHOKE_DURATION_SUM_MS
Cumulative milliseconds peers spent unchoked before re-choking (counter). Divide by REMOTE_RECHOKE_TOTAL for mean unchoke duration.
REMOTE_UNCHOKE_TOTAL
Times a remote peer unchoked us (counter).
SES_ACTIVE_TORRENTS
Metric index: current number of active (non-paused) torrents (gauge).
SES_IP_FILTER_BLOCKED
Metric index: total connections blocked by the IP filter (counter).
SES_NUM_TORRENTS
Metric index: total number of torrents in the session (gauge).
SES_QUEUE_PAUSED_BY_AUTO
Metric index: total torrents paused by auto-management (counter).
SES_UPTIME_SECS
Metric index: session uptime in seconds (gauge).
TARGET_DEPTH_BELOW_32
Deprecated: see TARGET_DEPTH_SUM.
TARGET_DEPTH_SAMPLES
Deprecated: see TARGET_DEPTH_SUM.
TARGET_DEPTH_SUM
Deprecated: dynamic depth gate removed in v0.186.4. Slot retained to preserve counter index stability for existing benchmark CSVs.

Functions§

session_stats_metrics
Return static metadata for all session metrics.