1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Real-time statistics tracking and monitoring module.
//!
//! This module provides atomic counters for tracking all tracker activity,
//! enabling real-time monitoring and Prometheus metrics export.
//!
//! # Statistics Categories
//!
//! ## Core Metrics
//! - Torrent counts and updates
//! - Peer counts (seeds, leeches)
//! - Completion counts
//! - User counts and updates
//!
//! ## Protocol Metrics
//! - TCP IPv4/IPv6 connections, announces, scrapes
//! - UDP IPv4/IPv6 connections, announces, scrapes
//! - API request counts
//! - Error and failure counts
//!
//! ## Feature Metrics
//! - Whitelist/blacklist entries and updates
//! - API key counts and updates
//! - WebSocket cluster activity
//!
//! # Thread Safety
//!
//! All statistics are stored as atomic integers, allowing safe concurrent
//! updates from multiple worker threads without locking overhead.
//!
//! # Monitoring Integration
//!
//! - JSON format via `/stats` endpoint
//! - Prometheus format via `/metrics` endpoint
//!
//! # Example
//!
//! ```rust,ignore
//! use torrust_actix::stats::enums::stats_event::StatsEvent;
//!
//! // Update statistics
//! tracker.update_stats(StatsEvent::Tcp4AnnouncesHandled, 1);
//!
//! // Read statistics
//! let stats = tracker.stats.get_stats();
//! ```
/// Statistics event enumeration.
/// Implementation blocks for statistics operations.
/// Statistics data structures (atomic counters).
/// Unit tests for statistics functionality.