kaspanet / rusty-kaspa

Kaspa full-node and related libraries in the Rust programming language. This is a stable version at the initial rollout phases.
ISC License
371 stars 118 forks source link

Adds missing logs and other minor convenient additions #362

Closed michaelsutton closed 6 months ago

michaelsutton commented 6 months ago

Adds some missing logs and is meant to be an aggregated PR for other minor convenient additions. Please open a PR over this branch if you wish to add anything. All changes should be small in scope.

Some suggestions to add here:

  1. Add to Consensus an atomic boolean set at Consensus::signal_exit which can be used by processors such as the pruning processor to exit long operations early if the app is shutting down. Another place to use this flag is PruningProofManager::validate_pruning_point_proof.
  2. Add --norpc flag support to kaspad cmd options
  3. Metrics logs: split perf-monitor metrics log to two more readable and short lines. Consider printing numbers also in readable format with units such as KB,MB,GB. Change cmd option perf_metrics_interval_sec default value to 10. **

** Current state:

2023-12-20 09:50:04.076+02:00 [TRACE] [perf-monitor] metrics: CountersSnapshot { resident_set_size: 6538289152, virtual_memory_size: 15633260544, core_num: 24, cpu_usage: 0.779554540262707, fd_num: 3069, disk_io_read_bytes: 307925639168, disk_io_write_bytes: 411801882624, disk_io_read_per_sec: 22688499.00039984, disk_io_write_per_sec: 16169864.854058377 }

Desired state:

2023-12-20 09:50:04.076+02:00 [TRACE] [perf-monitor] process metrics: RSS: 6538289152 (6.53GB), VIRT: 15633260544 (15.63GB), cores: 24, cpu usage (per core): 0.779
2023-12-20 09:50:04.076+02:00 [TRACE] [perf-monitor] disk io metrics: FD: 3069, read: 307925639168 (307GB), write: 411801882624 (411GB), read rate: 22688499.00039984 (22MB/s), write rate: 16169864.854058377 (16MB/s) 

(the only reason to keep the long numbers as well is for log parsing)