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§
- Session
Counters - Atomic counter array shared between session and torrent actors.
- Session
Stats Metric - Static metadata for a single session metric.
Enums§
- Metric
Kind - 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::diagnosticsis 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
AcquirePiecerequests returningNoneAvailable(counter). - DISPATCH_
ACQUIRE_ RTT_ US - Metric index: cumulative
AcquirePieceround-trip microseconds (counter). - DISPATCH_
ACQUIRE_ TOTAL - Metric index: total
AcquirePiecerequests handled (counter). - DISPATCH_
ACQUIRE_ US - Metric index: cumulative microseconds spent in
AcquirePiecehandling (counter). - DISPATCH_
CURSOR_ RESUMED - Metric index:
acquire_piececalls 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 oforder_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_notifywakeups 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_TOTALindicate 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_piececalls whose Phase 2 linear walk overorder_map.orderwas short-circuited because the peer’s bitfield does not intersectqueue_pieces(counter). Ratio againstDISPATCH_ACQUIRE_TOTALreveals how often peers ask for work they have no eligible piece for — the bitfield-intersection guard short- circuits these inO(num_pieces / 8)bytes instead ofO(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_COUNTfor 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_COUNTfor 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_TOTALfor 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.