observability: tracing gum, automatically cross ref traceID (#5079)

* add some gum

* bump expander

* gum

* fix all remaining issues

* last fixup

* Update node/gum/proc-macro/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* change

* netowrk

* fixins

* chore

* allow optional fmt str + args, prep for expr as kv field

* tracing -> gum rename fallout

* restrict further

* allow multiple levels of field accesses

* another round of docs and a slip of the pen

* update ADR

* fixup lock fiel

* use target: instead of target=

* minors

* fix

* chore

* Update node/gum/README.md

Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com>
This commit is contained in:
Bernhard Schuster
2022-03-15 12:05:16 +01:00
committed by GitHub
parent fa359fd1f7
commit d631f1dea8
130 changed files with 1708 additions and 808 deletions
@@ -8,7 +8,7 @@ edition = "2021"
futures = "0.3.21"
futures-timer = "3.0.2"
parity-scale-codec = { version = "3.1.0", default-features = false, features = ["bit-vec", "derive"] }
tracing = "0.1.32"
gum = { package = "tracing-gum", path = "../../gum" }
bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
lru = "0.7"
merlin = "2.0"
@@ -236,7 +236,7 @@ pub(crate) fn compute_assignments(
config.assignment_keys.is_empty() ||
config.validator_groups.is_empty()
{
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
n_cores = config.n_cores,
has_assignment_keys = !config.assignment_keys.is_empty(),
@@ -255,7 +255,7 @@ pub(crate) fn compute_assignments(
Err(sc_keystore::Error::Unavailable) => None,
Err(sc_keystore::Error::Io(e)) if e.kind() == std::io::ErrorKind::NotFound => None,
Err(e) => {
tracing::warn!(target: LOG_TARGET, "Encountered keystore error: {:?}", e);
gum::warn!(target: LOG_TARGET, "Encountered keystore error: {:?}", e);
None
},
}
@@ -263,7 +263,7 @@ pub(crate) fn compute_assignments(
match key {
None => {
tracing::trace!(target: LOG_TARGET, "No assignment key");
gum::trace!(target: LOG_TARGET, "No assignment key");
return HashMap::new()
},
Some(k) => k,
@@ -277,7 +277,7 @@ pub(crate) fn compute_assignments(
.map(|(c_hash, core, _)| (c_hash, core))
.collect::<Vec<_>>();
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
assignable_cores = leaving_cores.len(),
"Assigning to candidates from different backing groups"
@@ -333,7 +333,7 @@ fn compute_relay_vrf_modulo_assignments(
if let Some((candidate_hash, _)) =
leaving_cores.clone().into_iter().find(|(_, c)| c == core)
{
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
?candidate_hash,
?core,
@@ -415,7 +415,7 @@ fn compute_relay_vrf_delay_assignments(
};
if used {
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
?candidate_hash,
?core,
@@ -138,7 +138,7 @@ async fn imported_block_info(
.as_ref()
.map_or(true, |s| session_index < s.earliest_session())
{
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
"Block {} is from ancient session {}. Skipping",
block_hash,
@@ -188,11 +188,7 @@ async fn imported_block_info(
{
Some(s) => s,
None => {
tracing::debug!(
target: LOG_TARGET,
"Session info unavailable for block {}",
block_hash,
);
gum::debug!(target: LOG_TARGET, "Session info unavailable for block {}", block_hash,);
return Ok(None)
},
@@ -227,7 +223,7 @@ async fn imported_block_info(
}
},
None => {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
"BABE VRF info unavailable for block {}",
block_hash,
@@ -238,12 +234,12 @@ async fn imported_block_info(
}
};
tracing::trace!(target: LOG_TARGET, n_assignments = assignments.len(), "Produced assignments");
gum::trace!(target: LOG_TARGET, n_assignments = assignments.len(), "Produced assignments");
let force_approve =
block_header.digest.convert_first(|l| match ConsensusLog::from_digest_item(l) {
Ok(Some(ConsensusLog::ForceApprove(num))) if num < block_header.number => {
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
?block_hash,
current_number = block_header.number,
@@ -256,7 +252,7 @@ async fn imported_block_info(
Ok(Some(_)) => None,
Ok(None) => None,
Err(err) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?err,
?block_hash,
@@ -313,7 +309,7 @@ pub(crate) async fn handle_new_head(
match h_rx.await? {
Err(e) => {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
"Chain API subsystem temporarily unreachable {}",
e,
@@ -322,7 +318,7 @@ pub(crate) async fn handle_new_head(
return Ok(Vec::new())
},
Ok(None) => {
tracing::warn!(target: LOG_TARGET, "Missing header for new head {}", head);
gum::warn!(target: LOG_TARGET, "Missing header for new head {}", head);
return Ok(Vec::new())
},
Ok(Some(h)) => h,
@@ -332,7 +328,7 @@ pub(crate) async fn handle_new_head(
// Update session info based on most recent head.
match state.cache_session_info_for_head(ctx, head).await {
Err(e) => {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?head,
?e,
@@ -342,7 +338,7 @@ pub(crate) async fn handle_new_head(
return Ok(Vec::new())
},
Ok(Some(a @ SessionWindowUpdate::Advanced { .. })) => {
tracing::info!(
gum::info!(
target: LOG_TARGET,
update = ?a,
"Advanced session window for approvals",
@@ -404,7 +400,7 @@ pub(crate) async fn handle_new_head(
if !lost_to_finality {
// Such errors are likely spurious, but this prevents us from getting gaps
// in the approval-db.
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Unable to gather info about imported block {:?}. Skipping chain.",
(block_hash, block_header.number),
@@ -419,7 +415,7 @@ pub(crate) async fn handle_new_head(
imported_blocks_and_info
};
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
imported_blocks = imported_blocks_and_info.len(),
"Inserting imported blocks into database"
@@ -458,7 +454,7 @@ pub(crate) async fn handle_new_head(
let num_candidates = included_candidates.len();
let approved_bitfield = {
if needed_approvals == 0 {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
block_hash = ?block_hash,
"Insta-approving all candidates",
@@ -476,7 +472,7 @@ pub(crate) async fn handle_new_head(
}
}
if result.any() {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
block_hash = ?block_hash,
"Insta-approving {}/{} candidates as the number of validators is too low",
@@ -510,7 +506,7 @@ pub(crate) async fn handle_new_head(
};
if let Some(up_to) = force_approve {
tracing::debug!(target: LOG_TARGET, ?block_hash, up_to, "Enacting force-approve");
gum::debug!(target: LOG_TARGET, ?block_hash, up_to, "Enacting force-approve");
let approved_hashes = crate::ops::force_approve(db, block_hash, up_to)
.map_err(|e| SubsystemError::with_origin("approval-voting", e))?;
@@ -521,7 +517,7 @@ pub(crate) async fn handle_new_head(
}
}
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
?block_hash,
block_number = block_header.number,
@@ -561,7 +557,7 @@ pub(crate) async fn handle_new_head(
});
}
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
head = ?head,
chain_length = approval_meta.len(),
+41 -43
View File
@@ -621,7 +621,7 @@ impl State {
let session_info = match self.session_info(block_entry.session()) {
Some(s) => s,
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Unknown session info for {}",
block_entry.session()
@@ -718,7 +718,7 @@ where
match rx.await? {
Ok(number) => Some(number),
Err(err) => {
tracing::warn!(target: LOG_TARGET, ?err, "Failed fetching finalized number");
gum::warn!(target: LOG_TARGET, ?err, "Failed fetching finalized number");
None
},
}
@@ -962,13 +962,11 @@ async fn handle_actions(
match confirmation_rx.await {
Err(oneshot::Canceled) => {
tracing::debug!(target: LOG_TARGET, "Dispute coordinator confirmation lost",)
gum::debug!(target: LOG_TARGET, "Dispute coordinator confirmation lost",)
},
Ok(ImportStatementsResult::ValidImport) => {},
Ok(ImportStatementsResult::InvalidImport) => tracing::warn!(
target: LOG_TARGET,
"Failed to import statements of validity",
),
Ok(ImportStatementsResult::InvalidImport) =>
gum::warn!(target: LOG_TARGET, "Failed to import statements of validity",),
}
},
Action::NoteApprovedInChainSelection(block_hash) => {
@@ -1004,7 +1002,7 @@ fn distribution_messages_for_activation(
let block_entry = match db.load_block_entry(&block_hash)? {
Some(b) => b,
None => {
tracing::warn!(target: LOG_TARGET, ?block_hash, "Missing block entry");
gum::warn!(target: LOG_TARGET, ?block_hash, "Missing block entry");
continue
},
@@ -1021,7 +1019,7 @@ fn distribution_messages_for_activation(
let candidate_entry = match db.load_candidate_entry(&candidate_hash)? {
Some(c) => c,
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?block_hash,
?candidate_hash,
@@ -1068,7 +1066,7 @@ fn distribution_messages_for_activation(
}
},
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?block_hash,
?candidate_hash,
@@ -1105,7 +1103,7 @@ async fn handle_from_overseer(
Ok(block_imported_candidates) => {
// Schedule wakeups for all imported candidates.
for block_batch in block_imported_candidates {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
block_number = ?block_batch.block_number,
block_hash = ?block_batch.block_hash,
@@ -1122,7 +1120,7 @@ async fn handle_from_overseer(
if let Some(our_tranche) = our_tranche {
let tick = our_tranche as Tick + block_batch.block_tick;
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
tranche = our_tranche,
candidate_hash = ?c_hash,
@@ -1150,7 +1148,7 @@ async fn handle_from_overseer(
actions
},
FromOverseer::Signal(OverseerSignal::BlockFinalized(block_hash, block_number)) => {
tracing::debug!(target: LOG_TARGET, ?block_hash, ?block_number, "Block finalized");
gum::debug!(target: LOG_TARGET, ?block_hash, ?block_number, "Block finalized");
*last_finalized_height = Some(block_number);
crate::ops::canonicalize(db, block_number, block_hash)
@@ -1262,7 +1260,7 @@ async fn handle_approved_ancestor(
let entry = match db.load_block_entry(&block_hash)? {
None => {
let block_number = target_number.saturating_sub(i as u32);
tracing::info!(
gum::info!(
target: LOG_TARGET,
unknown_number = ?block_number,
unknown_hash = ?block_hash,
@@ -1303,7 +1301,7 @@ async fn handle_approved_ancestor(
block_descriptions.clear();
let unapproved: Vec<_> = entry.unapproved_candidates().collect();
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
"Block {} is {} blocks deep and has {}/{} candidates unapproved",
block_hash,
@@ -1315,7 +1313,7 @@ async fn handle_approved_ancestor(
for candidate_hash in unapproved {
match db.load_candidate_entry(&candidate_hash)? {
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?candidate_hash,
"Missing expected candidate in DB",
@@ -1325,7 +1323,7 @@ async fn handle_approved_ancestor(
},
Some(c_entry) => match c_entry.approval_entry(&block_hash) {
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?candidate_hash,
?block_hash,
@@ -1357,7 +1355,7 @@ async fn handle_approved_ancestor(
};
match a_entry.our_assignment() {
None => tracing::debug!(
None => gum::debug!(
target: LOG_TARGET,
?candidate_hash,
?block_hash,
@@ -1374,7 +1372,7 @@ async fn handle_approved_ancestor(
let approved =
triggered && { a_entry.local_statements().1.is_some() };
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?candidate_hash,
?block_hash,
@@ -1394,7 +1392,7 @@ async fn handle_approved_ancestor(
}
}
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
"approved blocks {}-[{}]-{}",
target_number,
@@ -1507,7 +1505,7 @@ fn schedule_wakeup_action(
};
match maybe_action {
Some(Action::ScheduleWakeup { ref tick, .. }) => tracing::trace!(
Some(Action::ScheduleWakeup { ref tick, .. }) => gum::trace!(
target: LOG_TARGET,
tick,
?candidate_hash,
@@ -1515,7 +1513,7 @@ fn schedule_wakeup_action(
block_tick,
"Scheduling next wakeup.",
),
None => tracing::trace!(
None => gum::trace!(
target: LOG_TARGET,
?candidate_hash,
?block_hash,
@@ -1633,7 +1631,7 @@ fn check_and_import_assignment(
if is_duplicate {
AssignmentCheckResult::AcceptedDuplicate
} else {
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
validator = assignment.validator.0,
candidate_hash = ?assigned_candidate_hash,
@@ -1756,7 +1754,7 @@ fn check_and_import_approval<T>(
// importing the approval can be heavy as it may trigger acceptance for a series of blocks.
let t = with_response(ApprovalCheckResult::Accepted);
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
validator_index = approval.validator.0,
validator = ?pubkey,
@@ -1877,7 +1875,7 @@ fn advance_approval_state(
let is_approved = check.is_approved(tick_now.saturating_sub(APPROVAL_DELAY));
if is_approved {
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
?candidate_hash,
?block_hash,
@@ -1906,7 +1904,7 @@ fn advance_approval_state(
(is_approved, status)
} else {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?candidate_hash,
?block_hash,
@@ -2021,7 +2019,7 @@ fn process_wakeup(
let session_info = match state.session_info(block_entry.session()) {
Some(i) => i,
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Missing session info for live block {} in session {}",
relay_block,
@@ -2040,7 +2038,7 @@ fn process_wakeup(
let tranche_now = state.clock.tranche_now(state.slot_duration_millis, block_entry.slot());
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
tranche = tranche_now,
?candidate_hash,
@@ -2100,7 +2098,7 @@ fn process_wakeup(
block_entry.candidates().iter().position(|(_, h)| &candidate_hash == h);
if let Some(i) = index_in_candidate {
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
?candidate_hash,
para_id = ?candidate_receipt.descriptor.para_id,
@@ -2185,7 +2183,7 @@ async fn launch_approval(
let candidate_hash = candidate.hash();
let para_id = candidate.descriptor.para_id;
tracing::trace!(target: LOG_TARGET, ?candidate_hash, ?para_id, "Recovering data.");
gum::trace!(target: LOG_TARGET, ?candidate_hash, ?para_id, "Recovering data.");
let timer = metrics.time_recover_and_approve();
ctx.send_message(AvailabilityRecoveryMessage::RecoverAvailableData(
@@ -2219,7 +2217,7 @@ async fn launch_approval(
Ok(Err(e)) => {
match &e {
&RecoveryError::Unavailable => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?para_id,
?candidate_hash,
@@ -2230,7 +2228,7 @@ async fn launch_approval(
metrics_guard.take().on_approval_unavailable();
},
&RecoveryError::Invalid => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?para_id,
?candidate_hash,
@@ -2261,7 +2259,7 @@ async fn launch_approval(
Ok(Err(_)) => return ApprovalState::failed(validator_index, candidate_hash),
Ok(Ok(Some(code))) => code,
Ok(Ok(None)) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Validation code unavailable for block {:?} in the state of block {:?} (a recent descendant)",
candidate.descriptor.relay_parent,
@@ -2297,7 +2295,7 @@ async fn launch_approval(
// Validation checked out. Issue an approval command. If the underlying service is unreachable,
// then there isn't anything we can do.
tracing::trace!(target: LOG_TARGET, ?candidate_hash, ?para_id, "Candidate Valid");
gum::trace!(target: LOG_TARGET, ?candidate_hash, ?para_id, "Candidate Valid");
let expected_commitments_hash = candidate.commitments_hash;
if commitments.hash() == expected_commitments_hash {
@@ -2322,7 +2320,7 @@ async fn launch_approval(
}
},
Ok(Ok(ValidationResult::Invalid(reason))) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?reason,
?candidate_hash,
@@ -2346,7 +2344,7 @@ async fn launch_approval(
return ApprovalState::failed(validator_index, candidate_hash)
},
Ok(Err(e)) => {
tracing::error!(
gum::error!(
target: LOG_TARGET,
err = ?e,
?candidate_hash,
@@ -2385,7 +2383,7 @@ async fn issue_approval(
let candidate_index = match block_entry.candidates().iter().position(|e| e.1 == candidate_hash)
{
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Candidate hash {} is not present in the block entry's candidates for relay block {}",
candidate_hash,
@@ -2401,7 +2399,7 @@ async fn issue_approval(
let session_info = match state.session_info(block_entry.session()) {
Some(s) => s,
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Missing session info for live block {} in session {}",
block_hash,
@@ -2416,7 +2414,7 @@ async fn issue_approval(
let candidate_hash = match block_entry.candidate(candidate_index as usize) {
Some((_, h)) => h.clone(),
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Received malformed request to approve out-of-bounds candidate index {} included at block {:?}",
candidate_index,
@@ -2431,7 +2429,7 @@ async fn issue_approval(
let candidate_entry = match db.load_candidate_entry(&candidate_hash)? {
Some(c) => c,
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Missing entry for candidate index {} included at block {:?}",
candidate_index,
@@ -2446,7 +2444,7 @@ async fn issue_approval(
let validator_pubkey = match session_info.validators.get(validator_index.0 as usize) {
Some(p) => p,
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Validator index {} out of bounds in session {}",
validator_index.0,
@@ -2462,7 +2460,7 @@ async fn issue_approval(
let sig = match sign_approval(&state.keystore, &validator_pubkey, candidate_hash, session) {
Some(sig) => sig,
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
validator_index = ?validator_index,
session,
@@ -2485,7 +2483,7 @@ async fn issue_approval(
)
.expect("Statement just signed; should pass checks; qed");
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
?candidate_hash,
?block_hash,
@@ -512,7 +512,7 @@ fn test_harness<T: Future<Output = VirtualOverseer>>(
}
async fn overseer_send(overseer: &mut VirtualOverseer, msg: FromOverseer<ApprovalVotingMessage>) {
tracing::trace!("Sending message:\n{:?}", &msg);
gum::trace!("Sending message:\n{:?}", &msg);
overseer
.send(msg)
.timeout(TIMEOUT)
@@ -525,7 +525,7 @@ async fn overseer_recv(overseer: &mut VirtualOverseer) -> AllMessages {
.await
.expect(&format!("{:?} is enough to receive messages.", TIMEOUT));
tracing::trace!("Received message:\n{:?}", &msg);
gum::trace!("Received message:\n{:?}", &msg);
msg
}
@@ -534,7 +534,7 @@ async fn overseer_recv_with_timeout(
overseer: &mut VirtualOverseer,
timeout: Duration,
) -> Option<AllMessages> {
tracing::trace!("Waiting for message...");
gum::trace!("Waiting for message...");
overseer.recv().timeout(timeout).await
}
+1 -1
View File
@@ -9,7 +9,7 @@ futures = "0.3.21"
futures-timer = "3.0.2"
kvdb = "0.11.0"
thiserror = "1.0.30"
tracing = "0.1.32"
gum = { package = "tracing-gum", path = "../../gum" }
bitvec = "1.0.0"
parity-scale-codec = { version = "3.1.0", features = ["derive"] }
+13 -13
View File
@@ -163,7 +163,7 @@ fn query_inner<D: Decode>(
},
Ok(None) => Ok(None),
Err(err) => {
tracing::warn!(target: LOG_TARGET, ?err, "Error reading from the availability store");
gum::warn!(target: LOG_TARGET, ?err, "Error reading from the availability store");
Err(err.into())
},
}
@@ -384,10 +384,10 @@ impl Error {
match self {
// don't spam the log with spurious errors
Self::RuntimeApi(_) | Self::Oneshot(_) => {
tracing::debug!(target: LOG_TARGET, err = ?self)
gum::debug!(target: LOG_TARGET, err = ?self)
},
// it's worth reporting otherwise
_ => tracing::warn!(target: LOG_TARGET, err = ?self),
_ => gum::warn!(target: LOG_TARGET, err = ?self),
}
}
}
@@ -544,7 +544,7 @@ where
}
},
Ok(true) => {
tracing::info!(target: LOG_TARGET, "received `Conclude` signal, exiting");
gum::info!(target: LOG_TARGET, "received `Conclude` signal, exiting");
break
},
Ok(false) => continue,
@@ -721,7 +721,7 @@ fn note_block_backed(
) -> Result<(), Error> {
let candidate_hash = candidate.hash();
tracing::debug!(target: LOG_TARGET, ?candidate_hash, "Candidate backed");
gum::debug!(target: LOG_TARGET, ?candidate_hash, "Candidate backed");
if load_meta(db, config, &candidate_hash)?.is_none() {
let meta = CandidateMeta {
@@ -753,7 +753,7 @@ fn note_block_included(
None => {
// This is alarming. We've observed a block being included without ever seeing it backed.
// Warn and ignore.
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?candidate_hash,
"Candidate included without being backed?",
@@ -762,7 +762,7 @@ fn note_block_included(
Some(mut meta) => {
let be_block = (BEBlockNumber(block.0), block.1);
tracing::debug!(target: LOG_TARGET, ?candidate_hash, "Candidate included");
gum::debug!(target: LOG_TARGET, ?candidate_hash, "Candidate included");
meta.state = match meta.state {
State::Unavailable(at) => {
@@ -856,7 +856,7 @@ where
match rx.await? {
Err(err) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
batch_num,
?err,
@@ -866,7 +866,7 @@ where
break
},
Ok(None) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Availability store was informed that block #{} is finalized, \
but chain API has no finalized hash.",
@@ -944,7 +944,7 @@ fn update_blocks_at_finalized_height(
for (candidate_hash, is_finalized) in candidates {
let mut meta = match load_meta(&subsystem.db, &subsystem.config, &candidate_hash)? {
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Dangling candidate metadata for {}",
candidate_hash,
@@ -1061,7 +1061,7 @@ fn process_message(
)? {
Some(c) => chunks.push(c),
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?candidate,
index,
@@ -1151,7 +1151,7 @@ fn store_chunk(
None => return Ok(false), // out of bounds.
}
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?candidate_hash,
chunk_index = %chunk.index.0,
@@ -1217,7 +1217,7 @@ fn store_available_data(
subsystem.db.write(tx)?;
tracing::debug!(target: LOG_TARGET, ?candidate_hash, "Stored data and chunks");
gum::debug!(target: LOG_TARGET, ?candidate_hash, "Stored data and chunks");
Ok(())
}
+3 -3
View File
@@ -146,7 +146,7 @@ fn test_harness<T: Future<Output = VirtualOverseer>>(
const TIMEOUT: Duration = Duration::from_millis(100);
async fn overseer_send(overseer: &mut VirtualOverseer, msg: AvailabilityStoreMessage) {
tracing::trace!(meg = ?msg, "sending message");
gum::trace!(meg = ?msg, "sending message");
overseer
.send(FromOverseer::Communication { msg })
.timeout(TIMEOUT)
@@ -159,7 +159,7 @@ async fn overseer_recv(overseer: &mut VirtualOverseer) -> AllMessages {
.await
.expect(&format!("{:?} is more than enough to receive messages", TIMEOUT));
tracing::trace!(msg = ?msg, "received message");
gum::trace!(msg = ?msg, "received message");
msg
}
@@ -168,7 +168,7 @@ async fn overseer_recv_with_timeout(
overseer: &mut VirtualOverseer,
timeout: Duration,
) -> Option<AllMessages> {
tracing::trace!("waiting for message...");
gum::trace!("waiting for message...");
overseer.recv().timeout(timeout).await
}
+1 -1
View File
@@ -14,7 +14,7 @@ polkadot-node-subsystem-util = { path = "../../subsystem-util" }
erasure-coding = { package = "polkadot-erasure-coding", path = "../../../erasure-coding" }
statement-table = { package = "polkadot-statement-table", path = "../../../statement-table" }
bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
tracing = "0.1.32"
gum = { package = "tracing-gum", path = "../../gum" }
thiserror = "1.0.30"
[dev-dependencies]
+18 -18
View File
@@ -276,7 +276,7 @@ fn table_attested_to_backed(
validator_indices.set(position, true);
vote_positions.push((orig_idx, position));
} else {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Logic error: Validity vote from table does not correspond to group",
);
@@ -463,7 +463,7 @@ async fn validate_and_make_available(
let res = match v {
ValidationResult::Valid(commitments, validation_data) => {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
candidate_hash = ?candidate.hash(),
"Validation successful",
@@ -471,7 +471,7 @@ async fn validate_and_make_available(
// If validation produces a new set of commitments, we vote the candidate as invalid.
if commitments.hash() != expected_commitments_hash {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
candidate_hash = ?candidate.hash(),
actual_commitments = ?commitments,
@@ -493,7 +493,7 @@ async fn validate_and_make_available(
match erasure_valid {
Ok(()) => Ok((candidate, commitments, pov.clone())),
Err(InvalidErasureRoot) => {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
candidate_hash = ?candidate.hash(),
actual_commitments = ?commitments,
@@ -505,7 +505,7 @@ async fn validate_and_make_available(
}
},
ValidationResult::Invalid(reason) => {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
candidate_hash = ?candidate.hash(),
reason = ?reason,
@@ -621,7 +621,7 @@ impl CandidateBackingJob {
self.kick_off_validation_work(sender, attesting, c_span).await?
}
} else {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"AttestNoPoV was triggered without fallback being available."
);
@@ -647,13 +647,13 @@ impl CandidateBackingJob {
let bg = async move {
if let Err(e) = validate_and_make_available(params).await {
if let Error::BackgroundValidationMpsc(error) = e {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?error,
"Mpsc background validation mpsc died during validation- leaf no longer active?"
);
} else {
tracing::error!(
gum::error!(
target: LOG_TARGET,
"Failed to validate and make available: {:?}",
e
@@ -699,7 +699,7 @@ impl CandidateBackingJob {
span.as_mut().map(|span| span.add_follows_from(parent_span));
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
candidate_hash = ?candidate_hash,
candidate_receipt = ?candidate,
@@ -763,7 +763,7 @@ impl CandidateBackingJob {
statement: &SignedFullStatement,
root_span: &jaeger::Span,
) -> Result<Option<TableSummary>, Error> {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
statement = ?statement.payload().to_compact(),
validator_index = statement.validator_index().0,
@@ -784,7 +784,7 @@ impl CandidateBackingJob {
.dispatch_new_statement_to_dispute_coordinator(sender, candidate_hash, &statement)
.await
{
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
session_index = ?self.session_index,
relay_parent = ?self.parent,
@@ -809,7 +809,7 @@ impl CandidateBackingJob {
let span = self.remove_unbacked_span(&candidate_hash);
if let Some(backed) = table_attested_to_backed(attested, &self.table_context) {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
candidate_hash = ?candidate_hash,
relay_parent = ?self.parent,
@@ -904,11 +904,11 @@ impl CandidateBackingJob {
match confirmation_rx.await {
Err(oneshot::Canceled) => {
tracing::debug!(target: LOG_TARGET, "Dispute coordinator confirmation lost",)
gum::debug!(target: LOG_TARGET, "Dispute coordinator confirmation lost",)
},
Ok(ImportStatementsResult::ValidImport) => {},
Ok(ImportStatementsResult::InvalidImport) => {
tracing::warn!(target: LOG_TARGET, "Failed to import statements of validity",)
gum::warn!(target: LOG_TARGET, "Failed to import statements of validity",)
},
}
}
@@ -935,7 +935,7 @@ impl CandidateBackingJob {
// Sanity check that candidate is from our assignment.
if Some(candidate.descriptor().para_id) != self.assignment {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
our_assignment = ?self.assignment,
collation = ?candidate.descriptor().para_id,
@@ -1006,7 +1006,7 @@ impl CandidateBackingJob {
let descriptor = attesting.candidate.descriptor().clone();
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
candidate_hash = ?candidate_hash,
candidate_receipt = ?attesting.candidate,
@@ -1196,7 +1196,7 @@ impl util::JobTrait for CandidateBackingJob {
match $x {
Ok(x) => x,
Err(e) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
err = ?e,
"Failed to fetch runtime API data for job",
@@ -1241,7 +1241,7 @@ impl util::JobTrait for CandidateBackingJob {
Ok(v) => Some(v),
Err(util::Error::NotAValidator) => None,
Err(e) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
err = ?e,
"Cannot participate in candidate backing",
@@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
futures = "0.3.21"
tracing = "0.1.32"
gum = { package = "tracing-gum", path = "../../gum" }
polkadot-primitives = { path = "../../../primitives" }
polkadot-node-subsystem = { path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
@@ -106,7 +106,7 @@ async fn get_core_availability(
let res = rx.await.map_err(Into::into);
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
para_id = %core.para_id(),
availability = ?res,
@@ -172,7 +172,7 @@ async fn construct_availability_bitfield(
.await?;
let core_bits = FromIterator::from_iter(results.into_iter());
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?relay_parent,
"Signing Bitfield for {core_count} cores: {core_bits}",
@@ -247,7 +247,7 @@ impl JobTrait for BitfieldSigningJob {
let metrics = metrics.clone();
async move {
if let LeafStatus::Stale = leaf.status {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
hash = ?leaf.hash,
block_number = ?leaf.number,
@@ -288,7 +288,7 @@ impl JobTrait for BitfieldSigningJob {
{
Err(Error::Runtime(runtime_err)) => {
// Don't take down the node on runtime API errors.
tracing::warn!(target: LOG_TARGET, err = ?runtime_err, "Encountered a runtime API error");
gum::warn!(target: LOG_TARGET, err = ?runtime_err, "Encountered a runtime API error");
return Ok(())
},
Err(err) => return Err(err),
@@ -305,7 +305,7 @@ impl JobTrait for BitfieldSigningJob {
{
Some(b) => b,
None => {
tracing::error!(
gum::error!(
target: LOG_TARGET,
"Key was found at construction, but while signing it could not be found.",
);
@@ -7,7 +7,7 @@ edition = "2021"
[dependencies]
async-trait = "0.1.52"
futures = "0.3.21"
tracing = "0.1.32"
gum = { package = "tracing-gum", path = "../../gum" }
sp-maybe-compressed-blob = { package = "sp-maybe-compressed-blob", git = "https://github.com/paritytech/substrate", branch = "master" }
parity-scale-codec = { version = "3.1.0", default-features = false, features = ["bit-vec", "derive"] }
@@ -242,13 +242,13 @@ where
receiver
.await
.map_err(|_| {
tracing::debug!(target: LOG_TARGET, ?relay_parent, "Runtime API request dropped");
gum::debug!(target: LOG_TARGET, ?relay_parent, "Runtime API request dropped");
RuntimeRequestFailed
})
.and_then(|res| {
res.map_err(|e| {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?relay_parent,
err = ?e,
@@ -295,7 +295,7 @@ where
// during pre-checking voting the relay-chain will pin the code. In case the code
// actually is not there, we issue failed since this looks more like a bug. This
// leads to us abstaining.
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?relay_parent,
?validation_code_hash,
@@ -311,7 +311,7 @@ where
) {
Ok(code) => Pvf::from_code(code.into_owned()),
Err(e) => {
tracing::debug!(target: LOG_TARGET, err=?e, "precheck: cannot decompress validation code");
gum::debug!(target: LOG_TARGET, err=?e, "precheck: cannot decompress validation code");
return PreCheckOutcome::Invalid
},
};
@@ -481,7 +481,7 @@ async fn validate_candidate_exhaustive(
let _timer = metrics.time_validate_candidate_exhaustive();
let validation_code_hash = validation_code.hash();
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?validation_code_hash,
para_id = ?descriptor.para_id,
@@ -503,7 +503,7 @@ async fn validate_candidate_exhaustive(
) {
Ok(code) => code,
Err(e) => {
tracing::debug!(target: LOG_TARGET, err=?e, "Invalid validation code");
gum::debug!(target: LOG_TARGET, err=?e, "Invalid validation code");
// If the validation code is invalid, the candidate certainly is.
return Ok(ValidationResult::Invalid(InvalidCandidate::CodeDecompressionFailure))
@@ -514,7 +514,7 @@ async fn validate_candidate_exhaustive(
match sp_maybe_compressed_blob::decompress(&pov.block_data.0, POV_BOMB_LIMIT) {
Ok(block_data) => BlockData(block_data.to_vec()),
Err(e) => {
tracing::debug!(target: LOG_TARGET, err=?e, "Invalid PoV code");
gum::debug!(target: LOG_TARGET, err=?e, "Invalid PoV code");
// If the PoV is invalid, the candidate certainly is.
return Ok(ValidationResult::Invalid(InvalidCandidate::PoVDecompressionFailure))
@@ -533,7 +533,7 @@ async fn validate_candidate_exhaustive(
.await;
if let Err(ref e) = result {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
error = ?e,
"Failed to validate candidate",
+1 -1
View File
@@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
futures = "0.3.21"
tracing = "0.1.32"
gum = { package = "tracing-gum", path = "../../gum" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
polkadot-primitives = { path = "../../../primitives" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
+1 -1
View File
@@ -129,7 +129,7 @@ where
},
ChainApiMessage::Ancestors { hash, k, response_channel } => {
let _timer = subsystem.metrics.time_ancestors();
tracing::span!(tracing::Level::TRACE, "ChainApiMessage::Ancestors", subsystem=LOG_TARGET, hash=%hash, k=k);
gum::trace!(target: LOG_TARGET, hash=%hash, k=k, "ChainApiMessage::Ancestors");
let mut hash = hash;
@@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
futures = "0.3.21"
futures-timer = "3"
tracing = "0.1.32"
gum = { package = "tracing-gum", path = "../../gum" }
polkadot-primitives = { path = "../../../primitives" }
polkadot-node-primitives = { path = "../../primitives" }
polkadot-node-subsystem = { path = "../../subsystem" }
+13 -18
View File
@@ -207,9 +207,9 @@ impl Error {
fn trace(&self) {
match self {
// don't spam the log with spurious errors
Self::Oneshot(_) => tracing::debug!(target: LOG_TARGET, err = ?self),
Self::Oneshot(_) => gum::debug!(target: LOG_TARGET, err = ?self),
// it's worth reporting otherwise
_ => tracing::warn!(target: LOG_TARGET, err = ?self),
_ => gum::warn!(target: LOG_TARGET, err = ?self),
}
}
}
@@ -235,7 +235,7 @@ impl Clock for SystemClock {
match SystemTime::now().duration_since(UNIX_EPOCH) {
Ok(d) => d.as_secs(),
Err(e) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
err = ?e,
"Current time is before unix epoch. Validation will not work correctly."
@@ -356,7 +356,7 @@ async fn run<Context, B>(
break
},
Ok(()) => {
tracing::info!(target: LOG_TARGET, "received `Conclude` signal, exiting");
gum::info!(target: LOG_TARGET, "received `Conclude` signal, exiting");
break
},
}
@@ -444,7 +444,7 @@ async fn fetch_finalized(
let number = match number_rx.await? {
Ok(number) => number,
Err(err) => {
tracing::warn!(target: LOG_TARGET, ?err, "Fetching finalized number failed");
gum::warn!(target: LOG_TARGET, ?err, "Fetching finalized number failed");
return Ok(None)
},
};
@@ -455,16 +455,11 @@ async fn fetch_finalized(
match hash_rx.await? {
Err(err) => {
tracing::warn!(
target: LOG_TARGET,
number,
?err,
"Fetching finalized block number failed"
);
gum::warn!(target: LOG_TARGET, number, ?err, "Fetching finalized block number failed");
Ok(None)
},
Ok(None) => {
tracing::warn!(target: LOG_TARGET, number, "Missing hash for finalized block number");
gum::warn!(target: LOG_TARGET, number, "Missing hash for finalized block number");
Ok(None)
},
Ok(Some(h)) => Ok(Some((h, number))),
@@ -479,7 +474,7 @@ async fn fetch_header(
ctx.send_message(ChainApiMessage::BlockHeader(hash, tx)).await;
Ok(rx.await?.unwrap_or_else(|err| {
tracing::warn!(target: LOG_TARGET, ?hash, ?err, "Missing hash for finalized block number");
gum::warn!(target: LOG_TARGET, ?hash, ?err, "Missing hash for finalized block number");
None
}))
}
@@ -494,7 +489,7 @@ async fn fetch_block_weight(
let res = rx.await?;
Ok(res.unwrap_or_else(|err| {
tracing::warn!(target: LOG_TARGET, ?hash, ?err, "Missing hash for finalized block number");
gum::warn!(target: LOG_TARGET, ?hash, ?err, "Missing hash for finalized block number");
None
}))
}
@@ -518,7 +513,7 @@ async fn handle_active_leaf(
let header = match fetch_header(ctx, hash).await? {
None => {
tracing::warn!(target: LOG_TARGET, ?hash, "Missing header for new head");
gum::warn!(target: LOG_TARGET, ?hash, "Missing header for new head");
return Ok(Vec::new())
},
Some(h) => h,
@@ -540,7 +535,7 @@ async fn handle_active_leaf(
for (hash, header) in new_blocks.into_iter().rev() {
let weight = match fetch_block_weight(ctx, hash).await? {
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?hash,
"Missing block weight for new head. Skipping chain.",
@@ -580,7 +575,7 @@ fn extract_reversion_logs(header: &Header) -> Vec<BlockNumber> {
.enumerate()
.filter_map(|(i, d)| match ConsensusLog::from_digest_item(d) {
Err(e) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
err = ?e,
index = i,
@@ -592,7 +587,7 @@ fn extract_reversion_logs(header: &Header) -> Vec<BlockNumber> {
},
Ok(Some(ConsensusLog::Revert(b))) if b < number => Some(b),
Ok(Some(ConsensusLog::Revert(b))) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
revert_target = b,
block_number = number,
@@ -140,7 +140,7 @@ fn propagate_viability_update(
BlockEntryRef::Explicit(entry) => entry,
BlockEntryRef::Hash(hash) => match backend.load_block_entry(&hash)? {
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
block_hash = ?hash,
"Missing expected block entry"
@@ -360,7 +360,7 @@ fn apply_reversions(
let mut ancestor_entry =
match load_ancestor(backend, block_hash, block_number, revert_number)? {
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?block_hash,
block_number,
@@ -373,7 +373,7 @@ fn apply_reversions(
continue
},
Some(ancestor_entry) => {
tracing::info!(
gum::info!(
target: LOG_TARGET,
?block_hash,
block_number,
@@ -480,7 +480,7 @@ pub(super) fn finalize_block<'a, B: Backend + 'a>(
propagate_viability_update(&mut backend, child)?;
} else {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?finalized_hash,
finalized_number,
@@ -515,7 +515,7 @@ pub(super) fn approve_block(
backend.write_block_entry(entry);
}
} else {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
block_hash = ?approved_hash,
"Missing entry for freshly-approved block. Ignoring"
@@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
futures = "0.3.21"
tracing = "0.1.32"
gum = { package = "tracing-gum", path = "../../gum" }
parity-scale-codec = "3.1.0"
kvdb = "0.11.0"
thiserror = "1.0.30"
@@ -65,14 +65,14 @@ where
let res = run_until_error(&mut ctx, &subsystem).await;
match res.into_nested() {
Err(fatal) => {
tracing::error!(target: LOG_TARGET, "Observed fatal issue: {:?}", fatal);
gum::error!(target: LOG_TARGET, "Observed fatal issue: {:?}", fatal);
break
},
Ok(Err(jfyi)) => {
tracing::debug!(target: LOG_TARGET, "Observed issue: {:?}", jfyi);
gum::debug!(target: LOG_TARGET, "Observed issue: {:?}", jfyi);
},
Ok(Ok(())) => {
tracing::info!(target: LOG_TARGET, "Received `Conclude` signal, exiting");
gum::info!(target: LOG_TARGET, "Received `Conclude` signal, exiting");
break
},
}
@@ -119,10 +119,10 @@ impl JfyiError {
match self {
// don't spam the log with spurious errors
Self::Runtime(_) | Self::Oneshot(_) => {
tracing::debug!(target: LOG_TARGET, error = ?self)
gum::debug!(target: LOG_TARGET, error = ?self)
},
// it's worth reporting otherwise
_ => tracing::warn!(target: LOG_TARGET, error = ?self),
_ => gum::warn!(target: LOG_TARGET, error = ?self),
}
}
}
@@ -149,7 +149,7 @@ impl Initialized {
)
.await;
if let Ok(()) = res {
tracing::info!(target: LOG_TARGET, "received `Conclude` signal, exiting");
gum::info!(target: LOG_TARGET, "received `Conclude` signal, exiting");
return Ok(())
}
log_error(res)?;
@@ -268,7 +268,7 @@ impl Initialized {
.await
{
Err(e) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
err = ?e,
"Failed to update session cache for disputes",
@@ -283,11 +283,7 @@ impl Initialized {
self.error = None;
let session = window_end;
if self.highest_session < session {
tracing::trace!(
target: LOG_TARGET,
session,
"Observed new session. Pruning"
);
gum::trace!(target: LOG_TARGET, session, "Observed new session. Pruning");
self.highest_session = session;
@@ -304,7 +300,7 @@ impl Initialized {
.scrape_on_chain_votes(ctx, overlay_db, new_leaf.hash, now)
.await
.map_err(|err| {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Skipping scraping block #{}({}) due to error: {}",
new_leaf.number,
@@ -335,7 +331,7 @@ impl Initialized {
)
.await
.unwrap_or_else(|err| {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
activated_leaf = ?new_leaf,
error = ?err,
@@ -347,7 +343,7 @@ impl Initialized {
})
},
Err(err) => {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
activated_leaf = ?new_leaf,
error = ?err,
@@ -364,7 +360,7 @@ impl Initialized {
for ancestor in ancestors {
let _ = self.scrape_on_chain_votes(ctx, overlay_db, ancestor, now).await.map_err(
|err| {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
hash = ?ancestor,
error = ?err,
@@ -405,14 +401,14 @@ impl Initialized {
match rx.await {
Ok(Ok(Some(val))) => val,
Ok(Ok(None)) => {
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
relay_parent = ?new_leaf,
"No on chain votes stored for relay chain leaf");
return Ok(())
},
Ok(Err(e)) => {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
relay_parent = ?new_leaf,
error = ?e,
@@ -420,7 +416,7 @@ impl Initialized {
return Ok(())
},
Err(e) => {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
relay_parent = ?new_leaf,
error = ?e,
@@ -446,7 +442,7 @@ impl Initialized {
if let Some(session_info) = self.rolling_session_window.session_info(session) {
session_info.clone()
} else {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
relay_parent = ?new_leaf,
?session,
@@ -466,7 +462,7 @@ impl Initialized {
.validators
.get(validator_index.0 as usize)
.or_else(|| {
tracing::error!(
gum::error!(
target: LOG_TARGET,
relay_parent = ?new_leaf,
"Missing public key for validator {:?}",
@@ -506,11 +502,11 @@ impl Initialized {
)
.await?;
match import_result {
ImportStatementsResult::ValidImport => tracing::trace!(target: LOG_TARGET,
ImportStatementsResult::ValidImport => gum::trace!(target: LOG_TARGET,
relay_parent = ?new_leaf,
?session,
"Imported backing vote from on-chain"),
ImportStatementsResult::InvalidImport => tracing::warn!(target: LOG_TARGET,
ImportStatementsResult::InvalidImport => gum::warn!(target: LOG_TARGET,
relay_parent = ?new_leaf,
?session,
"Attempted import of on-chain backing votes failed"),
@@ -537,7 +533,7 @@ impl Initialized {
{
session_info.clone()
} else {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
relay_parent = ?new_leaf,
?session,
@@ -549,7 +545,7 @@ impl Initialized {
.validators
.get(validator_index.0 as usize)
.or_else(|| {
tracing::error!(
gum::error!(
target: LOG_TARGET,
relay_parent = ?new_leaf,
?session,
@@ -584,12 +580,12 @@ impl Initialized {
)
.await?;
match import_result {
ImportStatementsResult::ValidImport => tracing::trace!(target: LOG_TARGET,
ImportStatementsResult::ValidImport => gum::trace!(target: LOG_TARGET,
relay_parent = ?new_leaf,
?candidate_hash,
?session,
"Imported statement of concluded dispute from on-chain"),
ImportStatementsResult::InvalidImport => tracing::warn!(target: LOG_TARGET,
ImportStatementsResult::InvalidImport => gum::warn!(target: LOG_TARGET,
relay_parent = ?new_leaf,
?candidate_hash,
?session,
@@ -679,7 +675,7 @@ impl Initialized {
{
query_output.push((session_index, candidate_hash, v.into()));
} else {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
session_index,
"No votes found for candidate",
@@ -753,7 +749,7 @@ impl Initialized {
let session_info = match self.rolling_session_window.session_info(session) {
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
session,
"Importing statement lacks info for session which has an active dispute",
@@ -794,7 +790,7 @@ impl Initialized {
true,
)
} else {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
session,
"Not seen backing vote for candidate which has an active dispute",
@@ -837,7 +833,7 @@ impl Initialized {
.get(val_index.0 as usize)
.map_or(true, |v| v != statement.validator_public())
{
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?val_index,
session,
@@ -907,7 +903,7 @@ impl Initialized {
}
// Only validity stating votes or validator had free spam slot?
if !free_spam_slots_available {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?candidate_hash,
?session,
@@ -931,7 +927,7 @@ impl Initialized {
// Participate in dispute if the imported vote was not local, we did not vote before either
// and we actually have keys to issue a local vote.
if !is_local && !voted_already && is_disputed && !controlled_indices.is_empty() {
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
candidate_hash = ?candidate_receipt.hash(),
priority = ?comparator.is_some(),
@@ -959,7 +955,7 @@ impl Initialized {
let status = if is_disputed {
let status = recent_disputes.entry((session, candidate_hash)).or_insert_with(|| {
tracing::info!(
gum::info!(
target: LOG_TARGET,
?candidate_hash,
session,
@@ -994,7 +990,7 @@ impl Initialized {
}
if !was_concluded_valid && concluded_valid {
tracing::info!(
gum::info!(
target: LOG_TARGET,
?candidate_hash,
session,
@@ -1004,7 +1000,7 @@ impl Initialized {
}
if !was_concluded_invalid && concluded_invalid {
tracing::info!(
gum::info!(
target: LOG_TARGET,
?candidate_hash,
session,
@@ -1038,7 +1034,7 @@ impl Initialized {
// Load session info.
let info = match self.rolling_session_window.session_info(session) {
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
session,
"Missing info for session which has an active dispute",
@@ -1088,7 +1084,7 @@ impl Initialized {
},
Ok(None) => {},
Err(e) => {
tracing::error!(
gum::error!(
target: LOG_TARGET,
err = ?e,
"Encountered keystore error while signing dispute statement",
@@ -1102,11 +1098,7 @@ impl Initialized {
let dispute_message =
match make_dispute_message(info, &votes, statement.clone(), *index) {
Err(err) => {
tracing::debug!(
target: LOG_TARGET,
?err,
"Creating dispute message failed."
);
gum::debug!(target: LOG_TARGET, ?err, "Creating dispute message failed.");
continue
},
Ok(dispute_message) => dispute_message,
@@ -1130,7 +1122,7 @@ impl Initialized {
.await?
{
ImportStatementsResult::InvalidImport => {
tracing::error!(
gum::error!(
target: LOG_TARGET,
?candidate_hash,
?session,
@@ -1138,7 +1130,7 @@ impl Initialized {
);
},
ImportStatementsResult::ValidImport => {
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
?candidate_hash,
?session,
@@ -194,7 +194,7 @@ impl DisputeCoordinatorSubsystem {
let (first_leaf, rolling_session_window) = match get_rolling_session_window(ctx).await {
Ok(Some(update)) => update,
Ok(None) => {
tracing::info!(target: LOG_TARGET, "received `Conclude` signal, exiting");
gum::info!(target: LOG_TARGET, "received `Conclude` signal, exiting");
return Ok(None)
},
Err(e) => {
@@ -267,11 +267,7 @@ impl DisputeCoordinatorSubsystem {
get_active_with_status(disputes.into_iter(), clock.now()).collect(),
Ok(None) => Vec::new(),
Err(e) => {
tracing::error!(
target: LOG_TARGET,
"Failed initial load of recent disputes: {:?}",
e
);
gum::error!(target: LOG_TARGET, "Failed initial load of recent disputes: {:?}", e);
return Err(e.into())
},
};
@@ -285,7 +281,7 @@ impl DisputeCoordinatorSubsystem {
Ok(Some(votes)) => votes.into(),
Ok(None) => continue,
Err(e) => {
tracing::error!(
gum::error!(
target: LOG_TARGET,
"Failed initial load of candidate votes: {:?}",
e
@@ -296,7 +292,7 @@ impl DisputeCoordinatorSubsystem {
let validators = match rolling_session_window.session_info(session) {
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
session,
"Missing info for session which has an active dispute",
@@ -401,7 +397,7 @@ where
// hour old database state, we should rather cancel contained oneshots and delay
// finality until we are fully functional.
{
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?msg,
"Received msg before first active leaves update. This is not expected - message will be dropped."
@@ -162,7 +162,7 @@ impl OrderingProvider {
}
let n = match get_block_number(sender, candidate.descriptor().relay_parent).await? {
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
candidate_hash = ?candidate_hash,
"Candidate's relay_parent could not be found via chain API, but we saw candidate included?!"
@@ -197,7 +197,7 @@ impl OrderingProvider {
)
.await
.unwrap_or_else(|err| {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
activated_leaf = ?activated,
error = ?err,
@@ -209,7 +209,7 @@ impl OrderingProvider {
})
},
Err(err) => {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
activated_leaf = ?activated,
error = ?err,
@@ -309,7 +309,7 @@ impl OrderingProvider {
None => {
// It's assumed that it's impossible to retrieve
// more than N ancestors for block number N.
tracing::error!(
gum::error!(
target: LOG_TARGET,
"Received {} ancestors for block number {} from Chain API",
hashes.len(),
@@ -266,7 +266,7 @@ async fn participate(
let available_data = match recover_available_data_rx.await {
Err(oneshot::Canceled) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"`Oneshot` got cancelled when recovering available data {:?}",
req.candidate_hash(),
@@ -298,7 +298,7 @@ async fn participate(
{
Ok(Some(code)) => code,
Ok(None) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Validation code unavailable for code hash {:?} in the state of block {:?}",
req.candidate_receipt().descriptor.validation_code_hash,
@@ -309,7 +309,7 @@ async fn participate(
return
},
Err(err) => {
tracing::warn!(target: LOG_TARGET, ?err, "Error when fetching validation code.");
gum::warn!(target: LOG_TARGET, ?err, "Error when fetching validation code.");
send_result(&mut result_sender, req, ParticipationOutcome::Error).await;
return
},
@@ -333,14 +333,14 @@ async fn participate(
match store_available_data_rx.await {
Err(oneshot::Canceled) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"`Oneshot` got cancelled when storing available data {:?}",
req.candidate_hash(),
);
},
Ok(Err(err)) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?err,
"Failed to store available data for candidate {:?}",
@@ -375,7 +375,7 @@ async fn participate(
// the validation and if valid, whether the commitments hash matches
match validation_rx.await {
Err(oneshot::Canceled) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"`Oneshot` got cancelled when validating candidate {:?}",
req.candidate_hash(),
@@ -384,7 +384,7 @@ async fn participate(
return
},
Ok(Err(err)) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Candidate {:?} validation failed with: {:?}",
req.candidate_hash(),
@@ -394,7 +394,7 @@ async fn participate(
send_result(&mut result_sender, req, ParticipationOutcome::Invalid).await;
},
Ok(Ok(ValidationResult::Invalid(invalid))) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Candidate {:?} considered invalid: {:?}",
req.candidate_hash(),
@@ -405,7 +405,7 @@ async fn participate(
},
Ok(Ok(ValidationResult::Valid(commitments, _))) => {
if commitments.hash() != req.candidate_receipt().commitments_hash {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
expected = ?req.candidate_receipt().commitments_hash,
got = ?commitments.hash(),
@@ -427,7 +427,7 @@ async fn send_result(
outcome: ParticipationOutcome,
) {
if let Err(err) = sender.feed(WorkerMessage::from_request(req, outcome)).await {
tracing::error!(
gum::error!(
target: LOG_TARGET,
?err,
"Sending back participation result failed. Dispute coordinator not working properly!"
@@ -67,7 +67,7 @@ impl SpamSlots {
let spam_vote_count = slots.entry((*session, *validator)).or_default();
*spam_vote_count += 1;
if *spam_vote_count > MAX_SPAM_VOTES {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?session,
?validator,
@@ -152,7 +152,7 @@ impl Clock for SystemClock {
match SystemTime::now().duration_since(UNIX_EPOCH) {
Ok(d) => d.as_secs(),
Err(e) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
err = ?e,
"Current time is before unix epoch. Validation will not work correctly."
@@ -7,7 +7,7 @@ edition = "2021"
[dependencies]
futures = "0.3.21"
futures-timer = "3.0.2"
tracing = "0.1.32"
gum = { package = "tracing-gum", path = "../../gum" }
thiserror = "1.0.30"
async-trait = "0.1.52"
polkadot-node-subsystem = { path = "../../subsystem" }
@@ -88,7 +88,7 @@ impl ParachainsInherentDataProvider {
parent_header,
},
Err(err) => {
tracing::debug!(
gum::debug!(
?err,
"Could not get provisioner inherent data; injecting default data",
);
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2021"
[dependencies]
bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
futures = "0.3.21"
tracing = "0.1.32"
gum = { package = "tracing-gum", path = "../../gum" }
thiserror = "1.0.30"
polkadot-primitives = { path = "../../../primitives" }
polkadot-node-primitives = { path = "../../primitives" }
+7 -7
View File
@@ -265,7 +265,7 @@ impl ProvisionerJob {
)
.await
{
tracing::warn!(target: LOG_TARGET, err = ?err, "failed to assemble or send inherent data");
gum::warn!(target: LOG_TARGET, err = ?err, "failed to assemble or send inherent data");
self.metrics.on_inherent_data_request(Err(()));
} else {
self.metrics.on_inherent_data_request(Ok(()));
@@ -451,7 +451,7 @@ async fn select_candidates(
descriptor.persisted_validation_data_hash == computed_validation_data_hash
}) {
let candidate_hash = candidate.hash();
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
"Selecting candidate {}. para_id={} core={}",
candidate_hash,
@@ -509,7 +509,7 @@ async fn select_candidates(
true
});
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
n_candidates = candidates.len(),
n_cores = availability_cores.len(),
@@ -557,7 +557,7 @@ fn bitfields_indicate_availability(
// in principle, this function might return a `Result<bool, Error>` so that we can more clearly express this error condition
// however, in practice, that would just push off an error-handling routine which would look a whole lot like this one.
// simpler to just handle the error internally here.
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
validator_idx = %validator_idx,
availability_len = %availability_len,
@@ -598,7 +598,7 @@ async fn request_disputes(
let recent_disputes = match rx.await {
Ok(r) => r,
Err(oneshot::Canceled) => {
tracing::warn!(target: LOG_TARGET, "Unable to gather {:?} disputes", active_or_recent);
gum::warn!(target: LOG_TARGET, "Unable to gather {:?} disputes", active_or_recent);
Vec::new()
},
};
@@ -618,7 +618,7 @@ async fn request_votes(
match rx.await {
Ok(v) => v,
Err(oneshot::Canceled) => {
tracing::warn!(target: LOG_TARGET, "Unable to query candidate votes");
gum::warn!(target: LOG_TARGET, "Unable to query candidate votes");
Vec::new()
},
}
@@ -666,7 +666,7 @@ async fn select_disputes(
// If the active ones are already exceeding the bounds, randomly select a subset.
let recent = request_disputes(sender, RequestType::Recent).await;
let disputes = if recent.len() > MAX_DISPUTES_FORWARDED_TO_RUNTIME {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Recent disputes are excessive ({} > {}), reduce to active ones, and selected",
recent.len(),
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2021"
[dependencies]
futures = "0.3.21"
thiserror = "1.0.30"
tracing = "0.1.32"
gum = { package = "tracing-gum", path = "../../gum" }
polkadot-node-primitives = { path = "../../primitives" }
polkadot-node-subsystem = { path = "../../subsystem" }
+15 -20
View File
@@ -185,7 +185,7 @@ async fn handle_pvf_check(
outcome: PreCheckOutcome,
validation_code_hash: ValidationCodeHash,
) {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?validation_code_hash,
"Received pre-check result: {:?}",
@@ -200,7 +200,7 @@ async fn handle_pvf_check(
//
// Returning here will leave the PVF in the view dangling. Since it is there, no new
// pre-checking request will be sent.
tracing::info!(
gum::info!(
target: LOG_TARGET,
?validation_code_hash,
"Pre-check failed, abstaining from voting",
@@ -212,7 +212,7 @@ async fn handle_pvf_check(
match state.view.on_judgement(validation_code_hash, judgement) {
Ok(()) => (),
Err(()) => {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?validation_code_hash,
"received judgement for an unknown (or removed) PVF hash",
@@ -254,7 +254,7 @@ async fn handle_from_overseer(
) -> Option<Conclude> {
match from_overseer {
FromOverseer::Signal(OverseerSignal::Conclude) => {
tracing::info!(target: LOG_TARGET, "Received `Conclude` signal, exiting");
gum::info!(target: LOG_TARGET, "Received `Conclude` signal, exiting");
Some(Conclude)
},
FromOverseer::Signal(OverseerSignal::BlockFinalized(_, _)) => {
@@ -360,7 +360,7 @@ async fn examine_activation(
leaf_hash: Hash,
leaf_number: BlockNumber,
) -> Option<ActivationEffect> {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
"Examining activation of leaf {:?} ({})",
leaf_hash,
@@ -370,7 +370,7 @@ async fn examine_activation(
let pending_pvfs = match runtime_api::pvfs_require_precheck(sender, leaf_hash).await {
Err(runtime_api::RuntimeRequestError::NotSupported) => return None,
Err(_) => {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
relay_parent = ?leaf_hash,
"cannot fetch PVFs that require pre-checking from runtime API",
@@ -398,7 +398,7 @@ async fn examine_activation(
None
},
Err(e) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
relay_parent = ?leaf_hash,
"cannot fetch session index from runtime API: {:?}",
@@ -421,7 +421,7 @@ async fn check_signing_credentials(
let validators = match runtime_api::validators(sender, leaf).await {
Ok(v) => v,
Err(e) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
relay_parent = ?leaf,
"error occured during requesting validators: {:?}",
@@ -453,7 +453,7 @@ async fn sign_and_submit_pvf_check_statement(
judgement: Judgement,
validation_code_hash: ValidationCodeHash,
) {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?validation_code_hash,
?relay_parent,
@@ -464,7 +464,7 @@ async fn sign_and_submit_pvf_check_statement(
metrics.on_vote_submission_started();
if voted.contains(&validation_code_hash) {
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
relay_parent = ?relay_parent,
?validation_code_hash,
@@ -491,7 +491,7 @@ async fn sign_and_submit_pvf_check_statement(
{
Ok(Some(signature)) => signature,
Ok(None) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?relay_parent,
validator_index = ?credentials.validator_index,
@@ -501,7 +501,7 @@ async fn sign_and_submit_pvf_check_statement(
return
},
Err(e) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?relay_parent,
validator_index = ?credentials.validator_index,
@@ -518,7 +518,7 @@ async fn sign_and_submit_pvf_check_statement(
metrics.on_vote_submitted();
},
Err(e) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?relay_parent,
?validation_code_hash,
@@ -540,12 +540,7 @@ async fn initiate_precheck(
validation_code_hash: ValidationCodeHash,
metrics: &Metrics,
) {
tracing::debug!(
target: LOG_TARGET,
?validation_code_hash,
?relay_parent,
"initiating a precheck",
);
gum::debug!(target: LOG_TARGET, ?validation_code_hash, ?relay_parent, "initiating a precheck",);
let (tx, rx) = oneshot::channel();
sender
@@ -563,7 +558,7 @@ async fn initiate_precheck(
// Pre-checking request dropped before replying. That can happen in case the
// overseer is shutting down. Our part of shutdown will be handled by the
// overseer conclude signal. Log it here just in case.
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?validation_code_hash,
?relay_parent,
@@ -85,7 +85,7 @@ pub(crate) async fn runtime_api_request<T>(
receiver
.await
.map_err(|_| {
tracing::debug!(target: LOG_TARGET, ?relay_parent, "Runtime API request dropped");
gum::debug!(target: LOG_TARGET, ?relay_parent, "Runtime API request dropped");
RuntimeRequestError::CommunicationError
})
.and_then(|res| {
@@ -93,7 +93,7 @@ pub(crate) async fn runtime_api_request<T>(
use RuntimeApiSubsystemError::*;
match e {
Execution { .. } => {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?relay_parent,
err = ?e,
+1 -1
View File
@@ -16,7 +16,7 @@ assert_matches = "1.4.0"
futures = "0.3.21"
futures-timer = "3.0.2"
slotmap = "1.0"
tracing = "0.1.32"
gum = { package = "tracing-gum", path = "../../gum" }
pin-project = "1.0.9"
rand = "0.8.5"
parity-scale-codec = { version = "3.1.0", default-features = false, features = ["derive"] }
+6 -6
View File
@@ -174,7 +174,7 @@ async fn purge_dead(metrics: &Metrics, workers: &mut Workers) {
fn handle_to_queue(queue: &mut Queue, to_queue: ToQueue) {
let ToQueue::Enqueue { artifact, execution_timeout, params, result_tx } = to_queue;
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
validation_code_hash = ?artifact.id.code_hash,
"enqueueing an artifact for execution",
@@ -208,7 +208,7 @@ fn handle_worker_spawned(queue: &mut Queue, idle: IdleWorker, handle: WorkerHand
queue.workers.spawn_inflight -= 1;
let worker = queue.workers.running.insert(WorkerData { idle: Some(idle), handle });
tracing::debug!(target: LOG_TARGET, ?worker, "execute worker spawned");
gum::debug!(target: LOG_TARGET, ?worker, "execute worker spawned");
if let Some(job) = queue.queue.pop_front() {
assign(queue, worker, job);
@@ -244,7 +244,7 @@ fn handle_job_finish(
};
queue.metrics.execute_finished();
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
validation_code_hash = ?artifact_id.code_hash,
worker_rip = idle_worker.is_none(),
@@ -288,7 +288,7 @@ fn handle_job_finish(
fn spawn_extra_worker(queue: &mut Queue) {
queue.metrics.execute_worker().on_begin_spawn();
tracing::debug!(target: LOG_TARGET, "spawning an extra worker");
gum::debug!(target: LOG_TARGET, "spawning an extra worker");
queue
.mux
@@ -303,7 +303,7 @@ async fn spawn_worker_task(program_path: PathBuf, spawn_timeout: Duration) -> Qu
match super::worker::spawn(&program_path, spawn_timeout).await {
Ok((idle, handle)) => break QueueEvent::Spawn(idle, handle),
Err(err) => {
tracing::warn!(target: LOG_TARGET, "failed to spawn an execute worker: {:?}", err);
gum::warn!(target: LOG_TARGET, "failed to spawn an execute worker: {:?}", err);
// Assume that the failure intermittent and retry after a delay.
Delay::new(Duration::from_secs(3)).await;
@@ -316,7 +316,7 @@ async fn spawn_worker_task(program_path: PathBuf, spawn_timeout: Duration) -> Qu
///
/// The worker must be running and idle.
fn assign(queue: &mut Queue, worker: Worker, job: ExecuteJob) {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
validation_code_hash = ?job.artifact.id,
?worker,
+5 -5
View File
@@ -72,7 +72,7 @@ pub async fn start_work(
) -> Outcome {
let IdleWorker { mut stream, pid } = worker;
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
worker_pid = %pid,
validation_code_hash = ?artifact.id.code_hash,
@@ -81,7 +81,7 @@ pub async fn start_work(
);
if let Err(error) = send_request(&mut stream, &artifact.path, &validation_params).await {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
worker_pid = %pid,
validation_code_hash = ?artifact.id.code_hash,
@@ -95,7 +95,7 @@ pub async fn start_work(
response = recv_response(&mut stream).fuse() => {
match response {
Err(error) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
worker_pid = %pid,
validation_code_hash = ?artifact.id.code_hash,
@@ -108,7 +108,7 @@ pub async fn start_work(
}
},
_ = Delay::new(execution_timeout).fuse() => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
worker_pid = %pid,
validation_code_hash = ?artifact.id.code_hash,
@@ -189,7 +189,7 @@ pub fn worker_entrypoint(socket_path: &str) {
})?;
loop {
let (artifact_path, params) = recv_request(&mut stream).await?;
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
worker_pid = %std::process::id(),
"worker: validating artifact {}",
+3 -3
View File
@@ -639,13 +639,13 @@ async fn handle_cleanup_pulse(
artifact_ttl: Duration,
) -> Result<(), Fatal> {
let to_remove = artifacts.prune(artifact_ttl);
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
"PVF pruning: {} artifacts reached their end of life",
to_remove.len(),
);
for artifact_id in to_remove {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
validation_code_hash = ?artifact_id.code_hash,
"pruning artifact",
@@ -664,7 +664,7 @@ async fn sweeper_task(mut sweeper_rx: mpsc::Receiver<PathBuf>) {
None => break,
Some(condemned) => {
let result = async_std::fs::remove_file(&condemned).await;
tracing::trace!(
gum::trace!(
target: LOG_TARGET,
?result,
"Sweeping the artifact file {}",
+3 -3
View File
@@ -201,7 +201,7 @@ fn handle_to_pool(
) {
match to_pool {
ToPool::Spawn => {
tracing::debug!(target: LOG_TARGET, "spawning a new prepare worker");
gum::debug!(target: LOG_TARGET, "spawning a new prepare worker");
metrics.prepare_worker().on_begin_spawn();
mux.push(spawn_worker_task(program_path.to_owned(), spawn_timeout).boxed());
},
@@ -234,7 +234,7 @@ fn handle_to_pool(
}
},
ToPool::Kill(worker) => {
tracing::debug!(target: LOG_TARGET, ?worker, "killing prepare worker");
gum::debug!(target: LOG_TARGET, ?worker, "killing prepare worker");
// It may be absent if it were previously already removed by `purge_dead`.
let _ = attempt_retire(metrics, spawned, worker);
},
@@ -248,7 +248,7 @@ async fn spawn_worker_task(program_path: PathBuf, spawn_timeout: Duration) -> Po
match worker::spawn(&program_path, spawn_timeout).await {
Ok((idle, handle)) => break PoolEvent::Spawn(idle, handle),
Err(err) => {
tracing::warn!(target: LOG_TARGET, "failed to spawn a prepare worker: {:?}", err);
gum::warn!(target: LOG_TARGET, "failed to spawn a prepare worker: {:?}", err);
// Assume that the failure intermittent and retry after a delay.
Delay::new(Duration::from_secs(3)).await;
+4 -4
View File
@@ -211,7 +211,7 @@ async fn handle_to_queue(queue: &mut Queue, to_queue: ToQueue) -> Result<(), Fat
}
async fn handle_enqueue(queue: &mut Queue, priority: Priority, pvf: Pvf) -> Result<(), Fatal> {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
validation_code_hash = ?pvf.code_hash,
?priority,
@@ -228,7 +228,7 @@ async fn handle_enqueue(queue: &mut Queue, priority: Priority, pvf: Pvf) -> Resu
// Precondtion for `Enqueue` is that it is sent only once for a PVF;
// Thus this should always be `false`;
// qed.
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"duplicate `enqueue` command received for {:?}",
artifact_id,
@@ -331,7 +331,7 @@ async fn handle_worker_concluded(
queue.artifact_id_to_job.remove(&artifact_id);
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
validation_code_hash = ?artifact_id.code_hash,
?worker,
@@ -370,7 +370,7 @@ async fn handle_worker_concluded(
}
async fn handle_worker_rip(queue: &mut Queue, worker: Worker) -> Result<(), Fatal> {
tracing::debug!(target: LOG_TARGET, ?worker, "prepare worker ripped");
gum::debug!(target: LOG_TARGET, ?worker, "prepare worker ripped");
let worker_data = queue.workers.remove(worker);
if let Some(WorkerData { job: Some(job), .. }) = worker_data {
+10 -10
View File
@@ -72,7 +72,7 @@ pub async fn start_work(
) -> Outcome {
let IdleWorker { mut stream, pid } = worker;
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
worker_pid = %pid,
"starting prepare for {}",
@@ -81,7 +81,7 @@ pub async fn start_work(
with_tmp_file(pid, cache_path, |tmp_file| async move {
if let Err(err) = send_request(&mut stream, code, &tmp_file).await {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
worker_pid = %pid,
"failed to send a prepare request: {:?}",
@@ -109,7 +109,7 @@ pub async fn start_work(
// By convention we expect encoded `PrepareResult`.
if let Ok(result) = PrepareResult::decode(&mut response_bytes.as_slice()) {
if result.is_ok() {
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
worker_pid = %pid,
"promoting WIP artifact {} to {}",
@@ -121,7 +121,7 @@ pub async fn start_work(
.await
.map(|_| Selected::Done(result))
.unwrap_or_else(|err| {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
worker_pid = %pid,
"failed to rename the artifact from {} to {}: {:?}",
@@ -137,7 +137,7 @@ pub async fn start_work(
} else {
// We received invalid bytes from the worker.
let bound_bytes = &response_bytes[..response_bytes.len().min(4)];
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
worker_pid = %pid,
"received unexpected response from the prepare worker: {}",
@@ -148,7 +148,7 @@ pub async fn start_work(
},
Ok(Err(err)) => {
// Communication error within the time limit.
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
worker_pid = %pid,
"failed to recv a prepare response: {:?}",
@@ -184,7 +184,7 @@ where
let tmp_file = match tmpfile_in("prepare-artifact-", cache_path).await {
Ok(f) => f,
Err(err) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
worker_pid = %pid,
"failed to create a temp file for the artifact: {:?}",
@@ -205,7 +205,7 @@ where
Ok(()) => (),
Err(err) if err.kind() == std::io::ErrorKind::NotFound => (),
Err(err) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
worker_pid = %pid,
"failed to remove the tmp file: {:?}",
@@ -246,7 +246,7 @@ pub fn worker_entrypoint(socket_path: &str) {
loop {
let (code, dest) = recv_request(&mut stream).await?;
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
worker_pid = %std::process::id(),
"worker: preparing artifact",
@@ -267,7 +267,7 @@ pub fn worker_entrypoint(socket_path: &str) {
let artifact_bytes = compiled_artifact.encode();
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
worker_pid = %std::process::id(),
"worker: writing artifact to {}",
+4 -4
View File
@@ -48,7 +48,7 @@ pub async fn spawn_with_program_path(
let socket_path = socket_path.to_owned();
async move {
let listener = UnixListener::bind(&socket_path).await.map_err(|err| {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
%debug_id,
"cannot bind unix socket: {:?}",
@@ -59,7 +59,7 @@ pub async fn spawn_with_program_path(
let handle =
WorkerHandle::spawn(program_path, extra_args, socket_path).map_err(|err| {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
%debug_id,
"cannot spawn a worker: {:?}",
@@ -71,7 +71,7 @@ pub async fn spawn_with_program_path(
futures::select! {
accept_result = listener.accept().fuse() => {
let (stream, _) = accept_result.map_err(|err| {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
%debug_id,
"cannot accept a worker: {:?}",
@@ -160,7 +160,7 @@ where
})
.unwrap_err(); // it's never `Ok` because it's `Ok(Never)`
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
worker_pid = %std::process::id(),
"pvf worker ({}): {:?}",
+1 -1
View File
@@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
futures = "0.3.21"
tracing = "0.1.32"
gum = { package = "tracing-gum", path = "../../gum" }
memory-lru = "0.1.0"
parity-util-mem = { version = "0.11.0", default-features = false }
+3 -3
View File
@@ -291,7 +291,7 @@ where
self.waiting_requests.push_back((request, receiver));
if self.waiting_requests.len() > MAX_PARALLEL_REQUESTS * 10 {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"{} runtime API requests waiting to be executed.",
self.waiting_requests.len(),
@@ -372,7 +372,7 @@ where
let runtime_version = api.api_version::<dyn ParachainHost<Block>>(&BlockId::Hash(relay_parent))
.unwrap_or_else(|e| {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"cannot query the runtime API version: {}",
e,
@@ -380,7 +380,7 @@ where
Some(0)
})
.unwrap_or_else(|| {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"no runtime version is reported"
);