mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
restructure polkadot-node-jaeger (#2642)
This commit is contained in:
committed by
GitHub
parent
59640a38bc
commit
ea6294fa79
@@ -104,10 +104,9 @@ impl JobTrait for CandidateSelectionJob {
|
||||
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send>> {
|
||||
let span = PerLeafSpan::new(span, "candidate-selection");
|
||||
async move {
|
||||
let _span = span.child_builder("query-runtime")
|
||||
.with_relay_parent(&relay_parent)
|
||||
.with_stage(jaeger::Stage::CandidateSelection)
|
||||
.build();
|
||||
let _span = span.child("query-runtime")
|
||||
.with_relay_parent(relay_parent)
|
||||
.with_stage(jaeger::Stage::CandidateSelection);
|
||||
let (groups, cores) = futures::try_join!(
|
||||
try_runtime_api!(request_validator_groups(relay_parent, &mut sender).await),
|
||||
try_runtime_api!(request_from_runtime(
|
||||
@@ -121,10 +120,9 @@ impl JobTrait for CandidateSelectionJob {
|
||||
let cores = try_runtime_api!(cores);
|
||||
|
||||
drop(_span);
|
||||
let _span = span.child_builder("validator-construction")
|
||||
.with_relay_parent(&relay_parent)
|
||||
.with_stage(jaeger::Stage::CandidateSelection)
|
||||
.build();
|
||||
let _span = span.child("validator-construction")
|
||||
.with_relay_parent(relay_parent)
|
||||
.with_stage(jaeger::Stage::CandidateSelection);
|
||||
|
||||
let n_cores = cores.len();
|
||||
|
||||
@@ -134,10 +132,9 @@ impl JobTrait for CandidateSelectionJob {
|
||||
Err(err) => return Err(Error::Util(err)),
|
||||
};
|
||||
|
||||
let mut assignment_span = span.child_builder("find-assignment")
|
||||
.with_relay_parent(&relay_parent)
|
||||
.with_stage(jaeger::Stage::CandidateSelection)
|
||||
.build();
|
||||
let assignment_span = span.child("find-assignment")
|
||||
.with_relay_parent(relay_parent)
|
||||
.with_stage(jaeger::Stage::CandidateSelection);
|
||||
|
||||
#[derive(Debug)]
|
||||
enum AssignmentState {
|
||||
@@ -172,15 +169,16 @@ impl JobTrait for CandidateSelectionJob {
|
||||
}
|
||||
}
|
||||
|
||||
let assignment = match assignment {
|
||||
let (assignment, assignment_span) = match assignment {
|
||||
AssignmentState::Scheduled(assignment) => {
|
||||
assignment_span.add_string_tag("assigned", "true");
|
||||
assignment_span.add_para_id(assignment);
|
||||
let assignment_span = assignment_span
|
||||
.with_string_tag("assigned", "true")
|
||||
.with_para_id(assignment);
|
||||
|
||||
assignment
|
||||
(assignment, assignment_span)
|
||||
}
|
||||
assignment => {
|
||||
assignment_span.add_string_tag("assigned", "false");
|
||||
let _assignment_span = assignment_span.with_string_tag("assigned", "false");
|
||||
|
||||
let validator_index = validator.index();
|
||||
let validator_id = validator.id();
|
||||
@@ -222,9 +220,8 @@ impl CandidateSelectionJob {
|
||||
}
|
||||
|
||||
async fn run_loop(&mut self, span: &jaeger::Span) -> Result<(), Error> {
|
||||
let span = span.child_builder("run-loop")
|
||||
.with_stage(jaeger::Stage::CandidateSelection)
|
||||
.build();
|
||||
let span = span.child("run-loop")
|
||||
.with_stage(jaeger::Stage::CandidateSelection);
|
||||
|
||||
loop {
|
||||
match self.receiver.next().await {
|
||||
@@ -240,19 +237,17 @@ impl CandidateSelectionJob {
|
||||
_relay_parent,
|
||||
candidate_receipt,
|
||||
)) => {
|
||||
let _span = span.child_builder("handle-invalid")
|
||||
let _span = span.child("handle-invalid")
|
||||
.with_stage(jaeger::Stage::CandidateSelection)
|
||||
.with_candidate(&candidate_receipt.hash())
|
||||
.with_relay_parent(&_relay_parent)
|
||||
.build();
|
||||
.with_candidate(candidate_receipt.hash())
|
||||
.with_relay_parent(_relay_parent);
|
||||
self.handle_invalid(candidate_receipt).await;
|
||||
}
|
||||
Some(CandidateSelectionMessage::Seconded(_relay_parent, statement)) => {
|
||||
let _span = span.child_builder("handle-seconded")
|
||||
let _span = span.child("handle-seconded")
|
||||
.with_stage(jaeger::Stage::CandidateSelection)
|
||||
.with_candidate(&statement.payload().candidate_hash())
|
||||
.with_relay_parent(&_relay_parent)
|
||||
.build();
|
||||
.with_candidate(statement.payload().candidate_hash())
|
||||
.with_relay_parent(_relay_parent);
|
||||
self.handle_seconded(statement).await;
|
||||
}
|
||||
None => break,
|
||||
|
||||
Reference in New Issue
Block a user