Skip to content
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

Tracker checker: call health check endpoints #641

Conversation

josecelano
Copy link
Member

Console command that runs some checks against running trackers. This PR only implements:

  • Basic scaffolding for the new binary (console app).
  • Make a request to the health check endpoints.

You can run it with:

cargo run --bin tracker_checker "./share/default/config/tracker_checker.json"

The configuration file contains the services you wan to check:

{
    "udp_trackers": [
        "127.0.0.1:6969"
    ],
    "http_trackers": [
        "http://127.0.0.1:7070"
    ],
    "health_checks": [
        "http://127.0.0.1:1313/health_check"
    ]
}

For the health_checks it only makes a request and shows OK if the response status was 200, otherwise, it shows the error.

It runs some checks against a running tracker.
@josecelano josecelano self-assigned this Jan 22, 2024
@josecelano josecelano added the Testing Checking Torrust label Jan 22, 2024
@josecelano josecelano linked an issue Jan 22, 2024 that may be closed by this pull request
@josecelano
Copy link
Member Author

The current output is:

$ cargo run --bin tracker_checker "./share/default/config/tracker_checker.json"
    Finished dev [optimized + debuginfo] target(s) in 0.07s
     Running `target/debug/tracker_checker ./share/default/config/tracker_checker.json`
Running checks for trackers ...
UDP trackers ...
✓ - UDP tracker at 127.0.0.1:6969 is OK (TODO)
HTTP trackers ...
✓ - HTTP tracker at http://127.0.0.1:7070/ is OK (TODO)
Health checks ...
✓ - Health API at http://127.0.0.1:1313/health_check is OK

@josecelano josecelano requested review from mickvandijke and da2ce7 and removed request for mickvandijke January 22, 2024 14:14
@josecelano
Copy link
Member Author

ACK b2ef4e0

Copy link

codecov bot commented Jan 22, 2024

Codecov Report

Attention: 87 lines in your changes are missing coverage. Please review.

Comparison is base (7ea6fb0) 77.59% compared to head (b2ef4e0) 77.03%.

Files Patch % Lines
src/checker/service.rs 0.00% 24 Missing ⚠️
src/checker/console.rs 0.00% 20 Missing ⚠️
src/checker/app.rs 0.00% 18 Missing ⚠️
src/checker/config.rs 81.69% 13 Missing ⚠️
src/checker/logger.rs 66.66% 12 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #641      +/-   ##
===========================================
- Coverage    77.59%   77.03%   -0.56%     
===========================================
  Files          125      130       +5     
  Lines         8349     8519     +170     
===========================================
+ Hits          6478     6563      +85     
- Misses        1871     1956      +85     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@josecelano josecelano merged commit 444c395 into torrust:develop Jan 22, 2024
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing Checking Torrust
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Tracker Checker: call health check endpoints
1 participant