Skip to content

Commit

Permalink
fix(log): reduce verbose logs for block commits (#5348)
Browse files Browse the repository at this point in the history
* Remove some verbose block write channel logs

* Only warn about tracing endpoint if the address is actually set

* Use CloneError instead of formatting a non-cloneable error

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
teor2345 and mergify[bot] authored Oct 7, 2022
1 parent 5b46068 commit acd61c5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
14 changes: 6 additions & 8 deletions zebra-state/src/service/finalized_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use zebra_chain::{block, parameters::Network};
use crate::{
request::FinalizedWithTrees,
service::{check, QueuedFinalized},
BoxError, Config, FinalizedBlock,
BoxError, CloneError, Config, FinalizedBlock,
};

mod disk_db;
Expand Down Expand Up @@ -171,15 +171,13 @@ impl FinalizedState {
);
};

// Some io errors can't be cloned, so we format them instead.
let owned_result = result
.as_ref()
.map(|_hash| finalized)
.map_err(|error| format!("{:?}", error).into());
// Make the error cloneable, so we can send it to the block verify future,
// and the block write task.
let result = result.map_err(CloneError::from);

let _ = rsp_tx.send(result);
let _ = rsp_tx.send(result.clone().map_err(BoxError::from));

owned_result
result.map(|_hash| finalized).map_err(BoxError::from)
}

/// Immediately commit a `finalized` block to the finalized state.
Expand Down
5 changes: 3 additions & 2 deletions zebra-state/src/service/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub(crate) fn validate_and_commit_non_finalized(
/// # Panics
///
/// If the `non_finalized_state` is empty.
#[instrument(level = "debug", skip(chain_tip_sender))]
#[instrument(level = "debug", skip(chain_tip_sender, non_finalized_state_sender))]
fn update_latest_chain_channels(
non_finalized_state: &NonFinalizedState,
chain_tip_sender: &mut ChainTipSender,
Expand Down Expand Up @@ -94,7 +94,8 @@ fn update_latest_chain_channels(
finalized_block_write_receiver,
non_finalized_block_write_receiver,
invalid_block_reset_sender,
chain_tip_sender
chain_tip_sender,
non_finalized_state_sender,
))]
pub fn write_blocks_from_channels(
mut finalized_block_write_receiver: UnboundedReceiver<QueuedFinalized>,
Expand Down
2 changes: 1 addition & 1 deletion zebrad/src/components/tracing/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async fn read_filter(req: Request<Body>) -> Result<String, String> {
impl TracingEndpoint {
/// Create the component.
pub fn new(config: &ZebradConfig) -> Result<Self, FrameworkError> {
if !cfg!(feature = "filter-reload") {
if config.tracing.endpoint_addr.is_some() && !cfg!(feature = "filter-reload") {
warn!(addr = ?config.tracing.endpoint_addr,
"unable to activate configured tracing filter endpoint: \
enable the 'filter-reload' feature when compiling zebrad",
Expand Down

0 comments on commit acd61c5

Please sign in to comment.