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

basic-authorship: debug level is now less spammy #6768

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions prdoc/pr_6768.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
title: '`basic-authorship`: debug level is now less spammy'
doc:
- audience: Node Dev
description: |-
The `debug` level in `sc-basic-authorship` is now less spammy. Previously it was outputing logs per individual transactions. It made quite hard to follow the logs (and also generates unneeded traffic in grafana).

Now debug level only show some internal details, without spamming output with per-transaction logs. They were moved to `trace` level.

I also added the `EndProposingReason` to the summary INFO message. This allows us to know what was the block limit (which is very useful for debugging).
crates:
- name: sc-basic-authorship
bump: major
- name: sc-proposer-metrics
bump: major
12 changes: 7 additions & 5 deletions substrate/client/basic-authorship/src/basic_authorship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ where
match sc_block_builder::BlockBuilder::push(block_builder, pending_tx_data) {
Ok(()) => {
transaction_pushed = true;
debug!(target: LOG_TARGET, "[{:?}] Pushed to the block.", pending_tx_hash);
trace!(target: LOG_TARGET, "[{:?}] Pushed to the block.", pending_tx_hash);
},
Err(ApplyExtrinsicFailed(Validity(e))) if e.exhausted_resources() => {
pending_iterator.report_invalid(&pending_tx);
Expand Down Expand Up @@ -565,20 +565,22 @@ where

if log::log_enabled!(log::Level::Info) {
info!(
"🎁 Prepared block for proposing at {} ({} ms) [hash: {:?}; parent_hash: {}; extrinsics_count: {}",
"🎁 Prepared block for proposing at {} ({} ms) hash: {:?}; parent_hash: {}; end: {:?}; extrinsics_count: {}",
block.header().number(),
block_took.as_millis(),
<Block as BlockT>::Hash::from(block.header().hash()),
block.header().parent_hash(),
end_reason,
extrinsics.len()
)
} else if log::log_enabled!(log::Level::Debug) {
debug!(
"🎁 Prepared block for proposing at {} ({} ms) [hash: {:?}; parent_hash: {}; {extrinsics_summary}",
} else if log::log_enabled!(log::Level::Trace) {
trace!(
"🎁 Prepared block for proposing at {} ({} ms) hash: {:?}; parent_hash: {}; end: {:?}; {extrinsics_summary}",
block.header().number(),
block_took.as_millis(),
<Block as BlockT>::Hash::from(block.header().hash()),
block.header().parent_hash(),
end_reason
);
}

Expand Down
2 changes: 1 addition & 1 deletion substrate/client/proposer-metrics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl MetricsLink {
}

/// The reason why proposing a block ended.
#[derive(Clone, Copy, PartialEq, Eq)]
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum EndProposingReason {
NoMoreTransactions,
HitDeadline,
Expand Down
Loading