Backing and collator protocol traces including para-id (#2620)

* improve backing/provisioner spans

* span for collation requests

* add para_id to unbacked candidate spans

* differentiate validation-construction and find-assignment in selection

* better find-assignment spans

* organize unbacked-candidate spans directly under job root

* Update node/core/provisioner/src/lib.rs

Co-authored-by: Andronik Ordian <write@reusable.software>

Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
Robert Habermeier
2021-03-14 11:51:14 -05:00
committed by GitHub
parent bdb3256396
commit 94d50afd4e
5 changed files with 111 additions and 32 deletions
+14 -1
View File
@@ -45,7 +45,7 @@
//! ```
use sp_core::traits::SpawnNamed;
use polkadot_primitives::v1::{CandidateHash, Hash, PoV, ValidatorIndex, BlakeTwo256, HashT};
use polkadot_primitives::v1::{CandidateHash, Hash, PoV, ValidatorIndex, BlakeTwo256, HashT, Id as ParaId};
use parity_scale_codec::Encode;
use sc_network::PeerId;
@@ -204,6 +204,14 @@ impl SpanBuilder {
self.span.add_string_tag("candidate-hash", &format!("{:?}", candidate_hash.0));
self
}
/// Attach a para-id to the span.
#[inline(always)]
pub fn with_para_id(mut self, para_id: ParaId) -> Self {
self.span.add_para_id(para_id);
self
}
/// Attach a candidate stage.
/// Should always come with a `CandidateHash`.
#[inline(always)]
@@ -305,6 +313,11 @@ impl Span {
}
}
/// Add the para-id to the span.
pub fn add_para_id(&mut self, para_id: ParaId) {
self.add_int_tag("para-id", u32::from(para_id) as i64);
}
/// Add an additional tag to the span.
pub fn add_string_tag(&mut self, tag: &str, value: &str) {
match self {