From 9e55472154b0d4d231b7931c415831358bfc56db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 4 Jan 2021 14:36:31 +0100 Subject: [PATCH] Improve jaeger spans for bitfield signing (#2189) --- polkadot/node/core/bitfield-signing/src/lib.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/polkadot/node/core/bitfield-signing/src/lib.rs b/polkadot/node/core/bitfield-signing/src/lib.rs index 3b30736a0a..ce82695997 100644 --- a/polkadot/node/core/bitfield-signing/src/lib.rs +++ b/polkadot/node/core/bitfield-signing/src/lib.rs @@ -69,16 +69,16 @@ pub enum Error { /// If there is a candidate pending availability, query the Availability Store /// for whether we have the availability chunk for our validator index. -#[tracing::instrument(level = "trace", skip(sender), fields(subsystem = LOG_TARGET))] +#[tracing::instrument(level = "trace", skip(sender, span), fields(subsystem = LOG_TARGET))] async fn get_core_availability( relay_parent: Hash, core: CoreState, validator_idx: ValidatorIndex, sender: &Mutex<&mut mpsc::Sender>, + span: &jaeger::JaegerSpan, ) -> Result { - let span = jaeger::hash_span(&relay_parent, "core-availability"); if let CoreState::Occupied(core) = core { - let _span = span.child("query chunk"); + let _span = span.child("query chunk availability"); let (tx, rx) = oneshot::channel(); sender @@ -103,10 +103,10 @@ async fn get_core_availability( "Candidate availability", ); - return res; + res + } else { + Ok(false) } - - Ok(false) } /// delegates to the v1 runtime API @@ -152,7 +152,8 @@ async fn construct_availability_bitfield( // Handle all cores concurrently // `try_join_all` returns all results in the same order as the input futures. let results = future::try_join_all( - availability_cores.into_iter().map(|core| get_core_availability(relay_parent, core, validator_idx, &sender)), + availability_cores.into_iter() + .map(|core| get_core_availability(relay_parent, core, validator_idx, &sender, span)), ).await?; Ok(AvailabilityBitfield(FromIterator::from_iter(results)))