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

Clean up verbosity 0 logging messages and display one-line block sync #3328

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from

Conversation

damons
Copy link

@damons damons commented Jun 24, 2024

Motivation

Currently verbosity settings of the client are mixed with info, debug, and trace log levels. When a user starts the node, the mix of messages is confusing and it's not clear if a node is connecting, syncing blocks, and working properly. It's important to give immediate feedback to users that their node is syncing as quickly as possible without distractions. This patch does two important things:

  1. When running with --verbosity 0 it only displays info messages that give meaningful information to the user about: peer connections (initial, drops, and refreshes) and block sync progress.
  2. It removes the extra \n\n's from the block advance and instead only prints: [{BLOCK_NUM}] {BLOCK_HASH} which gives a clear message to the user every time a block is added to the ledger. When run with verbosity 0, the primary information a user sees is blocks being added to the ledger. This gives immediate and clear feedback to the user that their client node is syncing properly and it shows the performance of the node.

Here's an example of --verbosity 0 output using this PR:

Screenshot 2024-06-23 at 8 29 11 PM

Several files where changed from info! to debug! and vice versa. Some debug!s were changed to trace! as some of the modules override the usual log levels which causes trace and debug logs to be produced at verbosity 0.

Test Plan

Compiled and run using --verbosity 0 and the client output matches the above screenshot.

…s to maximize user perception of block sync progress of a working, healthy node.
Copy link
Contributor

@joske joske left a comment

Choose a reason for hiding this comment

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

LGTM, I'm all for cleaner, less noisy but still informative logs.

@@ -352,7 +352,7 @@ impl<N: Network, C: ConsensusStorage<N>> LedgerService<N> for CoreLedgerService<
metrics::update_block_metrics(block);
}

tracing::info!("\n\nAdvanced to block {} at round {} - {}\n", block.height(), block.round(), block.hash());
tracing::info!("[{}] {}", block.height(), block.hash());
Copy link
Contributor

Choose a reason for hiding this comment

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

While more verbose, the previous message of Advanced to lock {} at round {} has been very valuable for debugging and parsing logs.

@@ -175,7 +175,7 @@ impl<N: Network> Gateway<N> {
worker_senders: IndexMap<u8, WorkerSender<N>>,
sync_sender: Option<SyncSender<N>>,
) {
debug!("Starting the gateway for the memory pool...");
trace!("Starting the gateway for the memory pool...");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
trace!("Starting the gateway for the memory pool...");
info!("Starting the gateway for the memory pool...");

This should be an info log like all the other module bootup messages.

@@ -524,7 +524,7 @@ impl<N: Network> Gateway<N> {
// If the event was unable to be sent, disconnect.
if let Err(e) = &result {
warn!("{CONTEXT} Failed to send '{name}' to '{peer_ip}': {e}");
debug!("{CONTEXT} Disconnecting from '{peer_ip}' (unable to send)");
trace!("{CONTEXT} Disconnecting from '{peer_ip}' (unable to send)");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
trace!("{CONTEXT} Disconnecting from '{peer_ip}' (unable to send)");
warn!("{CONTEXT} Disconnecting from '{peer_ip}' - Failed to send '{name}': {e}");

We can unify the 2 log messages to a single one that matches the other disconnect warn messages.

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.

3 participants