Rhai Worker Monitor (monitor
)
monitor
is a command-line tool designed to observe and display live information about Rhai workers managed by rhailib
. It provides insights into Redis queue congestion and a table of tasks being processed by specified workers.
Features (Planned)
- Live Redis Queue Visualization: Displays a textual, horizontal plot showing the number of tasks in the Redis queue for each monitored worker. The plot will be color-coded to indicate congestion levels and will update by polling the queue size.
- Task Table: Shows a table of tasks associated with each worker, including task hash, creation date, status (e.g., pending, running, completed, failed), and potentially other details.
Prerequisites
- Rust and Cargo installed.
- Access to the Redis instance used by the Rhai workers.
Building
Navigate to the rhailib/monitor
crate's root directory and build the project:
cargo build
Usage
To run the monitor, you need to specify which worker queues you want to observe using the --workers
(or -w
) flag. Provide a comma-separated list of worker names.
From the rhailib/monitor
root directory:
cargo run -- --workers <worker_name_1>[,<worker_name_2>,...]
Or from the parent rhailib
directory (workspace root):
cargo run -p monitor -- --workers <worker_name_1>[,<worker_name_2>,...]
Examples:
-
Monitor a single worker named
my_default_worker
(fromrhailib/monitor
):cargo run -- --workers my_default_worker
-
Monitor multiple workers,
image_processing_worker
anddata_analysis_worker
(fromrhailib
workspace root):cargo run -p monitor -- --workers image_processing_worker,data_analysis_worker
Command-Line Options
-w, --workers <WORKERS>
: (Required) A comma-separated list of worker names to monitor.
(Future options might include Redis connection parameters, polling intervals, etc.)
Development
The core logic for the monitor is located in rhailib/monitor/src/
:
lib.rs
: Main library file, defines modules.cli_logic.rs
: Handles argument parsing, Redis interaction, and orchestrates the display.plot.rs
: Responsible for generating the textual queue visualization.tasks.rs
: Responsible for fetching and displaying the task table.
The binary entry point is rhailib/monitor/src/main.rs
.