-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overhaul core Tracker: refactor statistics module #1228
Labels
Comments
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Jan 31, 2025
This is the frist step in a bigger refactor. We will move statistics out of the tracker-core package into new packages. Statistics are not related to the tracker-core or enven handled there. That logic belongs to upper layers.
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Jan 31, 2025
…in lib The statistics are only used at the higher levels: UDP and HTTP tracker. We will move them to new packages.
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Jan 31, 2025
…in lib The statistics are only used at the higher levels: UDP and HTTP tracker. We will move them to new packages.
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Jan 31, 2025
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Jan 31, 2025
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Jan 31, 2025
Parallel change, step 1: 1. [x] Start using HTTP Tracker Core Stats 2. [ ] Start using UDP Tracker Core Stats 3. [ ] Get metrics from HTTP and UDP Tracker Core Stats 4. [ ] Remove deprecate unified HTTP and UDP stats.
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Jan 31, 2025
Stats have been splited into HTTP and UDP stats. Parallel change, step 1: 1. [x] Start using HTTP Tracker Core Stats 2. [ ] Start using UDP Tracker Core Stats 3. [ ] Get metrics from HTTP and UDP Tracker Core Stats 4. [ ] Remove deprecate unified HTTP and UDP stats.
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Jan 31, 2025
Parallel change, step 2: 1. [x] Start using HTTP Tracker Core Stats 2. [x] Start using UDP Tracker Core Stats 3. [ ] Get metrics from HTTP and UDP Tracker Core Stats 4. [ ] Remove deprecate unified HTTP and UDP stats.
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Jan 31, 2025
…tats Stats have been splited into HTTP and UDP stats. Parallel change, step 3: 1. [x] Start using HTTP Tracker Core Stats 2. [x] Start using UDP Tracker Core Stats 3. [x] Get metrics from HTTP and UDP Tracker Core Stats 4. [ ] Remove deprecated unified HTTP and UDP stats.
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Jan 31, 2025
Stats have been split into HTTP and UDP stats. Parallel change, step 4: 1. [x] Start using HTTP Tracker Core Stats 2. [x] Start using UDP Tracker Core Stats 3. [x] Get metrics from HTTP and UDP Tracker Core Stats 4. [x] Remove deprecated unified HTTP and UDP stats.
Hi @da2ce7, I've finally introduced a new layer in the app architecture because I didn't fine a good place to put the stats: HTTP tracker:
Same for the UDP tracker. |
I've also created a new temporary dir ( |
Closed
I've also created sub-issues for extracting the packages in #753 |
josecelano
added a commit
that referenced
this issue
Jan 31, 2025
fd8b57a refactor: [#1228] remove deprecated unified HTTP and UDP stats (Jose Celano) 5576938 refactor: [#1228] get metrics from HTTP and UDP Tracker Core Stats (Jose Celano) f33665d refactor: [#1228] start using the udp tracker stats (Jose Celano) 5f08b2e refactor: [#1228] start using the http tracker stats (Jose Celano) 39cbeda refactor: [#1228] add new UDP and HTTP stats services to AppContainer (Jose Celano) 700c912 docs: update tracker core docs (Jose Celano) f99534a refactor: [#1228] split statistics mod into UDO and HTTP statistics (Jose Celano) 9318842 refactor: [#1228] move statistics back from tracker-core to main lib (Jose Celano) 0ad88b6 refactor: [#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
This was referenced Feb 6, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Parent issue: #1181
Relates to: #753
The recently extracted
tracker-core
package contains a statistics module:The module was already there (inside the core module) when I extracted the new package. However, now that the code is better organized I've realized that the core tracker doesn't send any stats event and all events are related to the UDP or HTTP trackers. That means the logic belongs to the higher level layer.
The Torrust Tracker application has these layers:
The UDP tracker should have the same layers:
However, for the UDP tracker, at the level of UDP tracker protocol we are also using the aquatic UDP protocol.
I'm going to move the module back to the main lib. I also see the opportunity to split it into two separate modules:
I will basically clone the code and move a copy to each server and finally remove the metrics that don't belong to the module. The final goal is let each type of tracker (UDP or HTTP) handle their or stats.
NOTE: I will not change the API endpoint exposing the metrics. That endpoint will remain the same:
https://tracker.torrust-demo.com/api/v1/stats
In the future I will like to change it to this:
And also rename the metrics to follow Prometheus recommendations.
cc @da2ce7
The text was updated successfully, but these errors were encountered: