provisioner logs minor janitor duties (#5142)

* provisioner data, one more log

* minor cleanups in provisioner logs

* remove deprecated foo in overseer

Closes #5128

* candidate_hash needs the ? prefix in gum

* demote to trace
This commit is contained in:
Bernhard Schuster
2022-03-17 10:02:49 +01:00
committed by GitHub
parent 1c443c65ef
commit 20d0cf0ae9
2 changed files with 23 additions and 11 deletions
+21 -9
View File
@@ -213,11 +213,10 @@ impl ProvisionerJob {
disputes_enabled: bool, disputes_enabled: bool,
span: PerLeafSpan, span: PerLeafSpan,
) -> Result<(), Error> { ) -> Result<(), Error> {
use ProvisionerMessage::{ProvisionableData, RequestInherentData};
loop { loop {
futures::select! { futures::select! {
msg = self.receiver.next() => match msg { msg = self.receiver.next() => match msg {
Some(RequestInherentData(_, return_sender)) => { Some(ProvisionerMessage::RequestInherentData(_, return_sender)) => {
let _span = span.child("req-inherent-data"); let _span = span.child("req-inherent-data");
let _timer = self.metrics.time_request_inherent_data(); let _timer = self.metrics.time_request_inherent_data();
@@ -227,7 +226,7 @@ impl ProvisionerJob {
self.awaiting_inherent.push(return_sender); self.awaiting_inherent.push(return_sender);
} }
} }
Some(ProvisionableData(_, data)) => { Some(ProvisionerMessage::ProvisionableData(_, data)) => {
let span = span.child("provisionable-data"); let span = span.child("provisionable-data");
let _timer = self.metrics.time_provisionable_data(); let _timer = self.metrics.time_provisionable_data();
@@ -289,8 +288,16 @@ impl ProvisionerJob {
ProvisionableData::Bitfield(_, signed_bitfield) => ProvisionableData::Bitfield(_, signed_bitfield) =>
self.signed_bitfields.push(signed_bitfield), self.signed_bitfields.push(signed_bitfield),
ProvisionableData::BackedCandidate(backed_candidate) => { ProvisionableData::BackedCandidate(backed_candidate) => {
let candidate_hash = backed_candidate.hash();
gum::trace!(
target: LOG_TARGET,
?candidate_hash,
para = ?backed_candidate.descriptor().para_id,
"noted backed candidate",
);
let _span = span let _span = span
.child("provisionable-backed") .child("provisionable-backed")
.with_candidate(candidate_hash)
.with_para_id(backed_candidate.descriptor().para_id); .with_para_id(backed_candidate.descriptor().para_id);
self.backed_candidates.push(backed_candidate) self.backed_candidates.push(backed_candidate)
}, },
@@ -452,7 +459,12 @@ async fn select_candidates(
let mut selected_candidates = let mut selected_candidates =
Vec::with_capacity(candidates.len().min(availability_cores.len())); Vec::with_capacity(candidates.len().min(availability_cores.len()));
gum::debug!(target: LOG_TARGET, leaf_hash=?relay_parent, "{} candidates before selection", candidates.len()); gum::debug!(
target: LOG_TARGET,
leaf_hash=?relay_parent,
n_candidates = candidates.len(),
"Candidate receipts (before selection)",
);
for (core_idx, core) in availability_cores.iter().enumerate() { for (core_idx, core) in availability_cores.iter().enumerate() {
let (scheduled_core, assumption) = match core { let (scheduled_core, assumption) = match core {
@@ -505,10 +517,10 @@ async fn select_candidates(
gum::trace!( gum::trace!(
target: LOG_TARGET, target: LOG_TARGET,
leaf_hash=?relay_parent, leaf_hash=?relay_parent,
"Selecting candidate {}. para_id={} core={}", ?candidate_hash,
candidate_hash, para = ?candidate.descriptor.para_id,
candidate.descriptor.para_id, core = core_idx,
core_idx, "Selected candidate receipt",
); );
selected_candidates.push(candidate_hash); selected_candidates.push(candidate_hash);
@@ -566,7 +578,7 @@ async fn select_candidates(
n_candidates = candidates.len(), n_candidates = candidates.len(),
n_cores = availability_cores.len(), n_cores = availability_cores.len(),
?relay_parent, ?relay_parent,
"Selected candidates for cores", "Selected backed candidates",
); );
Ok(candidates) Ok(candidates)
@@ -44,7 +44,7 @@ pub(crate) fn impl_dispatch(info: &OverseerInfo) -> TokenStream {
impl #message_wrapper { impl #message_wrapper {
/// Generated dispatch iterator generator. /// Generated dispatch iterator generator.
pub fn dispatch_iter(extern_msg: #extern_network_ty) -> impl Iterator<Item=Self> + Send { pub fn dispatch_iter(extern_msg: #extern_network_ty) -> impl Iterator<Item=Self> + Send {
::std::array::IntoIter::new([ [
#( #(
extern_msg extern_msg
// focuses on a `NetworkBridgeEvent< protocol_v1::* >` // focuses on a `NetworkBridgeEvent< protocol_v1::* >`
@@ -59,7 +59,7 @@ pub(crate) fn impl_dispatch(info: &OverseerInfo) -> TokenStream {
) )
}), }),
)* )*
]) ]
.into_iter() .into_iter()
.filter_map(|x: Option<_>| x) .filter_map(|x: Option<_>| x)
} }