Improve Network Spans (#2169)

* utility functions for erasure-coding threshold

* add candidate-hash tag to candidate jaeger spans

* debug implementation for jaeger span

* add a span to each live candidate in availability dist.

* availability span covers only our piece

* fix tests

* keep span alive slightly longer

* remove spammy bitfield-gossip-received log

* Revert "remove spammy bitfield-gossip-received log"

This reverts commit 831a2db506d66f64ea516af3caf891e8643f5c43.

* add claimed validator to bitfield-gossip span

* add peer-id to handle-incoming span

* add peer-id to availability distribution span

* Update node/network/availability-distribution/src/lib.rs

Co-authored-by: Bernhard Schuster <bernhard@ahoi.io>

* Update erasure-coding/src/lib.rs

Co-authored-by: Bernhard Schuster <bernhard@ahoi.io>

* Update node/subsystem/src/jaeger.rs

Co-authored-by: Bernhard Schuster <bernhard@ahoi.io>

Co-authored-by: Bernhard Schuster <bernhard@ahoi.io>
This commit is contained in:
Robert Habermeier
2021-01-04 12:29:53 -05:00
committed by GitHub
parent a864eaa093
commit 41102a6ff9
6 changed files with 278 additions and 132 deletions
@@ -50,6 +50,19 @@ fn chunk_protocol_message(
)
}
fn make_per_candidate() -> PerCandidate {
PerCandidate {
live_in: HashSet::new(),
message_vault: HashMap::new(),
received_messages: HashMap::new(),
sent_messages: HashMap::new(),
validators: Vec::new(),
validator_index: None,
descriptor: Default::default(),
span: jaeger::JaegerSpan::Disabled,
}
}
struct TestHarness {
virtual_overseer: test_helpers::TestSubsystemContextHandle<AvailabilityDistributionMessage>,
}
@@ -1024,9 +1037,10 @@ fn remove_relay_parent_only_removes_per_candidate_if_final() {
live_candidates: std::iter::once(candidate_hash_a).collect(),
});
state.per_candidate.insert(candidate_hash_a, PerCandidate {
live_in: vec![hash_a, hash_b].into_iter().collect(),
..Default::default()
state.per_candidate.insert(candidate_hash_a, {
let mut per_candidate = make_per_candidate();
per_candidate.live_in = vec![hash_a, hash_b].into_iter().collect();
per_candidate
});
state.remove_relay_parent(&hash_a);
@@ -1052,6 +1066,8 @@ fn add_relay_parent_includes_all_live_candidates() {
let candidate_hash_a = CandidateHash([10u8; 32].into());
let candidate_hash_b = CandidateHash([11u8; 32].into());
state.per_candidate.insert(candidate_hash_b, make_per_candidate());
let candidates = vec![
(candidate_hash_a, FetchedLiveCandidate::Fresh(Default::default())),
(candidate_hash_b, FetchedLiveCandidate::Cached),