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. |
josecelano
left a comment
There was a problem hiding this comment.
Hi @ngthhu looks good. Thank you! Just a couple of things.
Fix formatting errors
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.