-
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
chore:[#674] Tracker Checker: Ouput in JSON #810
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #810 +/- ##
===========================================
- Coverage 78.93% 78.91% -0.03%
===========================================
Files 162 163 +1
Lines 9186 9186
===========================================
- Hits 7251 7249 -2
- Misses 1935 1937 +2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ngthhu looks good. Thank you! Just a couple of things.
Fix formatting errors
https://github.com/torrust/torrust-tracker/actions/runs/8813597282/job/24196746331?pr=810
Output should be only the json
Command:
cargo run --bin tracker_checker -- --config-path "./share/default/config/tracker_checker.json"
Output:
Running checks for trackers ...
{
"udp_trackers": [
{
"url": "127.0.0.1:6969",
"status": {
"code": "ok",
"message": ""
}
}
],
"http_trackers": [
{
"url": "http://127.0.0.1:7070/",
"status": {
"code": "ok",
"message": ""
}
}
],
"health_checks": [
{
"url": "http://127.0.0.1:1313/health_check",
"status": {
"code": "ok",
"message": ""
}
}
]
}
Output should not include:
Running checks for trackers ...
You should be able to parse the output as a json. For example:
cargo run --bin tracker_checker -- --config-path "./share/default/config/tracker_checker.json"| jq
Finished `dev` profile [optimized + debuginfo] target(s) in 0.09s
Running `target/debug/tracker_checker --config-path ./share/default/config/tracker_checker.json`
parse error: Invalid numeric literal at line 1, column 8
thread 'main' panicked at library/std/src/io/stdio.rs:1118:9:
failed printing to stdout: Broken pipe (os error 32)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Is it good to name a file with a general name like |
Hi @ngthhu, Since it's a small mod and file, I don't see a big problem. In my case, when I read But, I would probably have named them:
pub struct Output {
pub url: String,
pub status: Status,
}
pub struct Status {
pub code: String,
pub message: String,
} Or:
pub struct Result {
pub url: String,
pub status: Status,
}
pub struct Status {
pub code: String,
pub message: String,
} |
ACK b27f002 |
No description provided.