Skip to content

feat(tracker-client): add monitor udp command to tracker_checker#1767

Merged
josecelano merged 21 commits into
torrust:developfrom
josecelano:1178-tracker-checker-udp-add-monitor-uptime-command
May 12, 2026
Merged

feat(tracker-client): add monitor udp command to tracker_checker#1767
josecelano merged 21 commits into
torrust:developfrom
josecelano:1178-tracker-checker-udp-add-monitor-uptime-command

Conversation

@josecelano
Copy link
Copy Markdown
Member

@josecelano josecelano commented May 12, 2026

Summary

  • add tracker_checker monitor udp command in tracker client
  • emit NDJSON probe events to stderr and final JSON summary to stdout
  • add support for --url, --interval, --timeout, --duration, and --info-hash
  • implement timeout/error handling and monitor statistics (total, timeouts, timeout_percent, latency fields)
  • update issue/spec and refactor-plan docs, including explicit deferral of success-path mock UDP integration test to the planned tracker-client repository split
  • refactor tracker_checker integration tests into two concern modules: configuration and monitor

Validation

  • cargo test -p torrust-tracker-client --test tracker_checker
  • linter all

Notes

  • Item 14 from the post-implementation plan is intentionally deferred, documented in the issue and closed refactor plan.

Usage Example

cargo run -p torrust-tracker-client --bin tracker_checker -- monitor udp \
  --url udp://udp1.torrust-tracker-demo.com:6969/announce \
  --interval 10 \
  --timeout 10 \
  --duration 60

The command emits per-probe NDJSON events to stderr and a final JSON summary to stdout.

Example Output

cargo run --quiet -p torrust-tracker-client --bin tracker_checker -- monitor udp --url udp://udp1.torrust-tracker-demo.com:6969/announce --interval 10 --timeout 10 --duration 60 2>/dev/null | jq
{
  "udp_trackers": [
    {
      "url": "udp://udp1.torrust-tracker-demo.com:6969/announce",
      "status": {
        "code": "ok",
        "message": "monitor completed",
        "stats": {
          "total": 6,
          "timeouts": 0,
          "timeout_percent": 0,
          "min_ms": 128,
          "max_ms": 145,
          "average_ms": 136,
          "last_ms": 137
        }
      }
    }
  ]
}

josecelano added 20 commits May 12, 2026 18:18
- Fix timeout_percent sample value: 33.3 -> 33 (integer, matches implementation)
- Add --info-hash row to CLI Options table
- Tick all completed Goals and Workflow Checkpoints
- Add unit test: all latency fields null when every probe times out
- Update refactor plan to mark items 1-4 as done
@josecelano josecelano requested a review from a team as a code owner May 12, 2026 17:49
@josecelano josecelano self-assigned this May 12, 2026
@josecelano josecelano requested a review from Copilot May 12, 2026 17:49
@josecelano josecelano linked an issue May 12, 2026 that may be closed by this pull request
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new tracker_checker monitor udp subcommand to the tracker client, emitting per-probe NDJSON events on stderr and a final JSON summary on stdout, and updates planning/docs around refactor plans and the Issue #1178 spec.

Changes:

  • Implement monitor udp command (CLI parsing + monitoring loop + JSON output + stats).
  • Refactor tracker_checker integration tests into separate configuration vs monitor modules.
  • Add refactor-plan documentation structure (template, lifecycle READMEs, skill doc) and update Issue #1178 spec/refactor plan docs.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
project-words.txt Adds millis to the project word list.
docs/templates/REFACTOR-PLAN.md Introduces a refactor-plan document template.
docs/refactor-plans/open/README.md Documents lifecycle/usage for open refactor plans.
docs/refactor-plans/drafts/README.md Documents lifecycle/usage for draft refactor plans.
docs/refactor-plans/closed/README.md Documents lifecycle/usage for closed refactor plans.
docs/refactor-plans/closed/agent-docs-refactor-plan.md Adds a closed refactor plan documenting prior agent-doc changes.
docs/refactor-plans/closed/1178-monitor-udp-post-implementation-improvements.md Captures post-implementation improvements and explicit deferrals for monitor-udp work.
docs/issues/open/1178-tracker-checker-udp-add-monitor-uptime-command.md Updates the Issue #1178 spec with final behavior notes, options, verification, and risks.
console/tracker-client/tests/tracker_checker/monitor.rs Adds integration test coverage for monitor udp output/exit code (timeout-only sink).
console/tracker-client/tests/tracker_checker/configuration.rs Moves configuration error contract tests into a focused module.
console/tracker-client/tests/tracker_checker.rs Reorganizes integration tests into module files via #[path = ...].
console/tracker-client/src/console/clients/checker/monitor/udp.rs Implements the UDP monitor runtime, stats aggregation, and JSON emission.
console/tracker-client/src/console/clients/checker/monitor/mod.rs Exposes the new monitor module.
console/tracker-client/src/console/clients/checker/mod.rs Wires monitor module into checker client module tree.
console/tracker-client/src/console/clients/checker/app.rs Adds clap subcommand parsing for monitor udp and dispatches to monitor runner.
.github/skills/dev/planning/create-refactor-plan/SKILL.md Adds a planning skill describing how to write and manage refactor plans.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread console/tracker-client/tests/tracker_checker/monitor.rs Outdated
Comment thread console/tracker-client/tests/tracker_checker/monitor.rs Outdated
Comment thread console/tracker-client/src/console/clients/checker/monitor/udp.rs
Comment thread docs/issues/open/1178-tracker-checker-udp-add-monitor-uptime-command.md Outdated
Comment thread docs/templates/REFACTOR-PLAN.md
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

❌ Patch coverage is 66.53226% with 83 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.00%. Comparing base (244c94e) to head (f76c733).

Files with missing lines Patch % Lines
...-client/src/console/clients/checker/monitor/udp.rs 65.38% 64 Missing and 8 partials ⚠️
.../tracker-client/src/console/clients/checker/app.rs 72.50% 7 Missing and 4 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1767      +/-   ##
===========================================
- Coverage    79.04%   79.00%   -0.05%     
===========================================
  Files          370      371       +1     
  Lines        27682    27928     +246     
  Branches     27682    27928     +246     
===========================================
+ Hits         21882    22065     +183     
- Misses        5517     5568      +51     
- Partials       283      295      +12     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@josecelano
Copy link
Copy Markdown
Member Author

ACK f76c733

@josecelano josecelano merged commit 8970b90 into torrust:develop May 12, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracker Checker (UDP): add command to monitor uptime

2 participants