You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fd8b57a refactor: [torrust#1228] remove deprecated unified HTTP and UDP stats (Jose Celano)
5576938 refactor: [torrust#1228] get metrics from HTTP and UDP Tracker Core Stats (Jose Celano)
f33665d refactor: [torrust#1228] start using the udp tracker stats (Jose Celano)
5f08b2e refactor: [torrust#1228] start using the http tracker stats (Jose Celano)
39cbeda refactor: [torrust#1228] add new UDP and HTTP stats services to AppContainer (Jose Celano)
700c912 docs: update tracker core docs (Jose Celano)
f99534a refactor: [torrust#1228] split statistics mod into UDO and HTTP statistics (Jose Celano)
9318842 refactor: [torrust#1228] move statistics back from tracker-core to main lib (Jose Celano)
0ad88b6 refactor: [torrust#1228] move type from tracker-core to main lib (Jose Celano)
Pull request description:
Overhaul core Tracker: refactor statistics module.
Statistics have been split into three parts:
- HTTP stats
- UDP stats
- API stats: the API uses both HTTP metrics and UDP metrics.
I have created a temporary directory (`src/packages/`) with the new packages. We need to create crates for those packages and move them to the `src/packages/` dir.
I didn't want to do that in this PR.
```
$ tree src/packages/
src/packages/
├── http_tracker_core
│ ├── mod.rs
│ └── statistics
│ ├── event
│ │ ├── handler.rs
│ │ ├── listener.rs
│ │ ├── mod.rs
│ │ └── sender.rs
│ ├── keeper.rs
│ ├── metrics.rs
│ ├── mod.rs
│ ├── repository.rs
│ ├── services.rs
│ └── setup.rs
├── mod.rs
├── tracker_api_core
│ ├── mod.rs
│ └── statistics
│ ├── metrics.rs
│ ├── mod.rs
│ └── services.rs
└── udp_tracker_core
├── mod.rs
└── statistics
├── event
│ ├── handler.rs
│ ├── listener.rs
│ ├── mod.rs
│ └── sender.rs
├── keeper.rs
├── metrics.rs
├── mod.rs
├── repository.rs
├── services.rs
└── setup.rs
9 directories, 27 files
```
The app layers are a little bit different from what I described initially in the issue:
Initial design:
```
Main Torrust Tracker
|
Axum HTTP tracker server (`packages\axum-http-tracker`. This hasn't been extracted yet)
|
HTTP tracker protocol (`packages\http-protocol`)
|
Core tracker (`packages\tracker-core`)
```
Final design:
```
Main Torrust Tracker
|
Axum HTTP tracker server (`packages\axum-http-tracker`. This hasn't been extracted yet)
|
HTTP tracker core (`src\packages\http_tracker_core`)
|
HTTP tracker protocol (`packages\http-protocol`)
|
Core tracker (`packages\tracker-core`)
```
I din't want to put stats in the `packages\http-protocol` because they are no part of the official HTTP tracker protocols. And I didn't want to put it in the axum server because it's code that can be re-used in other server implementations (using other frameworks).
ACKs for top commit:
josecelano:
ACK fd8b57a
Tree-SHA512: 75adfaef2bb7f356b2a135183f9eb0306e91fa6dce3e4195ed21dda261139267bcc7cbb7589093dd67c2800ddce5aa172a7ebba19870794436db53890c5a32ba
Copy file name to clipboardexpand all lines: packages/tracker-core/src/lib.rs
+1-56
Original file line number
Diff line number
Diff line change
@@ -346,7 +346,7 @@
346
346
//!
347
347
//! Services are domain services on top of the core tracker domain. Right now there are two types of service:
348
348
//!
349
-
//! - For statistics: [`crate::core::statistics::services`]
349
+
//! - For statistics: [`crate::packages::statistics::services`]
350
350
//! - For torrents: [`crate::core::torrent::services`]
351
351
//!
352
352
//! Services usually format the data inside the tracker to make it easier to consume by other parts.
@@ -370,60 +370,6 @@
370
370
//! To learn more about tracker authentication, refer to the following modules :
371
371
//!
372
372
//! - [`authentication`] module.
373
-
//! - [`core`](crate::core) module.
374
-
//! - [`http`](crate::servers::http) module.
375
-
//!
376
-
//! # Statistics
377
-
//!
378
-
//! The `Tracker` keeps metrics for some events:
379
-
//!
380
-
//! ```rust,no_run
381
-
//! pub struct Metrics {
382
-
//! // IP version 4
383
-
//!
384
-
//! // HTTP tracker
385
-
//! pub tcp4_connections_handled: u64,
386
-
//! pub tcp4_announces_handled: u64,
387
-
//! pub tcp4_scrapes_handled: u64,
388
-
//!
389
-
//! // UDP tracker
390
-
//! pub udp4_connections_handled: u64,
391
-
//! pub udp4_announces_handled: u64,
392
-
//! pub udp4_scrapes_handled: u64,
393
-
//!
394
-
//! // IP version 6
395
-
//!
396
-
//! // HTTP tracker
397
-
//! pub tcp6_connections_handled: u64,
398
-
//! pub tcp6_announces_handled: u64,
399
-
//! pub tcp6_scrapes_handled: u64,
400
-
//!
401
-
//! // UDP tracker
402
-
//! pub udp6_connections_handled: u64,
403
-
//! pub udp6_announces_handled: u64,
404
-
//! pub udp6_scrapes_handled: u64,
405
-
//! }
406
-
//! ```
407
-
//!
408
-
//! The metrics maintained by the `Tracker` are:
409
-
//!
410
-
//! - `connections_handled`: number of connections handled by the tracker
411
-
//! - `announces_handled`: number of `announce` requests handled by the tracker
412
-
//! - `scrapes_handled`: number of `scrape` handled requests by the tracker
413
-
//!
414
-
//! > **NOTICE**: as the HTTP tracker does not have an specific `connection` request like the UDP tracker, `connections_handled` are
415
-
//! > increased on every `announce` and `scrape` requests.
416
-
//!
417
-
//! The tracker exposes an event sender API that allows the tracker users to send events. When a higher application service handles a
418
-
//! `connection` , `announce` or `scrape` requests, it notifies the `Tracker` by sending statistics events.
419
-
//!
420
-
//! For example, the HTTP tracker would send an event like the following when it handles an `announce` request received from a peer using IP version 4.
0 commit comments