mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 03:31:10 +00:00
Add one Jaeger span per relay parent (#2196)
* Add one Jaeger span per relay parent This adds one Jaeger span per relay parent, instead of always creating new spans per relay parent. This should improve the UI view, because subsystems are now grouped below one common span. * Fix doc tests * Replace `PerLeaveSpan` to `PerLeafSpan` * More renaming * Moare * Update node/subsystem/src/lib.rs Co-authored-by: Andronik Ordian <write@reusable.software> * Skip the spans * Increase `spec_version` Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
@@ -32,7 +32,7 @@ use sp_keystore::{CryptoStore, SyncCryptoStorePtr};
|
||||
|
||||
use polkadot_erasure_coding::branch_hash;
|
||||
use polkadot_node_network_protocol::{
|
||||
v1 as protocol_v1, NetworkBridgeEvent, PeerId, ReputationChange as Rep, View,
|
||||
v1 as protocol_v1, NetworkBridgeEvent, PeerId, ReputationChange as Rep, View, OurView,
|
||||
};
|
||||
use polkadot_node_subsystem_util::metrics::{self, prometheus};
|
||||
use polkadot_primitives::v1::{
|
||||
@@ -45,10 +45,8 @@ use polkadot_subsystem::messages::{
|
||||
NetworkBridgeMessage, RuntimeApiMessage, RuntimeApiRequest,
|
||||
};
|
||||
use polkadot_subsystem::{
|
||||
jaeger,
|
||||
errors::{ChainApiError, RuntimeApiError},
|
||||
ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem, Subsystem,
|
||||
SubsystemContext, SubsystemError,
|
||||
jaeger, errors::{ChainApiError, RuntimeApiError},
|
||||
ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem, Subsystem, SubsystemContext, SubsystemError,
|
||||
};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::collections::hash_map::Entry;
|
||||
@@ -128,7 +126,7 @@ struct ProtocolState {
|
||||
peer_views: HashMap<PeerId, View>,
|
||||
|
||||
/// Our own view.
|
||||
view: View,
|
||||
view: OurView,
|
||||
|
||||
/// Caches a mapping of relay parents or ancestor to live candidate hashes.
|
||||
/// Allows fast intersection of live candidates with views and consecutive unioning.
|
||||
@@ -278,8 +276,8 @@ impl ProtocolState {
|
||||
}
|
||||
}
|
||||
|
||||
// Removes all entries from live_under which aren't referenced in the ancestry of
|
||||
// one of our live relay-chain heads.
|
||||
/// Removes all entries from live_under which aren't referenced in the ancestry of
|
||||
/// one of our live relay-chain heads.
|
||||
fn clean_up_live_under_cache(&mut self) {
|
||||
let extended_view: HashSet<_> = self.per_relay_parent.iter()
|
||||
.map(|(r_hash, v)| v.ancestors.iter().cloned().chain(iter::once(*r_hash)))
|
||||
@@ -353,7 +351,7 @@ async fn handle_our_view_change<Context>(
|
||||
ctx: &mut Context,
|
||||
keystore: &SyncCryptoStorePtr,
|
||||
state: &mut ProtocolState,
|
||||
view: View,
|
||||
view: OurView,
|
||||
metrics: &Metrics,
|
||||
) -> Result<()>
|
||||
where
|
||||
@@ -845,11 +843,11 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
// Metadata about a candidate that is part of the live_candidates set.
|
||||
//
|
||||
// Those which were not present in a cache are "fresh" and have their candidate descriptor attached. This
|
||||
// information is propagated to the higher level where it can be used to create data entries. Cached candidates
|
||||
// already have entries associated with them, and thus don't need this metadata to be fetched.
|
||||
/// Metadata about a candidate that is part of the live_candidates set.
|
||||
///
|
||||
/// Those which were not present in a cache are "fresh" and have their candidate descriptor attached. This
|
||||
/// information is propagated to the higher level where it can be used to create data entries. Cached candidates
|
||||
/// already have entries associated with them, and thus don't need this metadata to be fetched.
|
||||
#[derive(Debug)]
|
||||
enum FetchedLiveCandidate {
|
||||
Cached,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use super::*;
|
||||
use assert_matches::assert_matches;
|
||||
use polkadot_erasure_coding::{branches, obtain_chunks_v1 as obtain_chunks};
|
||||
use polkadot_node_network_protocol::{view, ObservedRole};
|
||||
use polkadot_node_network_protocol::{view, ObservedRole, our_view};
|
||||
use polkadot_node_subsystem_util::TimeoutExt;
|
||||
use polkadot_primitives::v1::{
|
||||
AvailableData, BlockData, CandidateCommitments, CandidateDescriptor, GroupIndex,
|
||||
@@ -398,7 +398,7 @@ async fn expect_chunks_network_message(
|
||||
|
||||
async fn change_our_view(
|
||||
virtual_overseer: &mut test_helpers::TestSubsystemContextHandle<AvailabilityDistributionMessage>,
|
||||
view: View,
|
||||
view: OurView,
|
||||
validator_public: &[ValidatorId],
|
||||
ancestors: Vec<Hash>,
|
||||
session_per_relay_parent: HashMap<Hash, SessionIndex>,
|
||||
@@ -574,7 +574,7 @@ fn check_views() {
|
||||
let genesis = Hash::repeat_byte(0xAA);
|
||||
change_our_view(
|
||||
&mut virtual_overseer,
|
||||
view![current],
|
||||
our_view![current],
|
||||
&validator_public,
|
||||
vec![ancestors[0], genesis],
|
||||
hashmap! { current => 1, genesis => 1 },
|
||||
@@ -641,7 +641,7 @@ fn check_views() {
|
||||
peer_b_2 => view![ancestors[0]],
|
||||
},
|
||||
);
|
||||
assert_eq!(view, view![current]);
|
||||
assert_eq!(view, our_view![current]);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -676,7 +676,7 @@ fn reputation_verification() {
|
||||
|
||||
change_our_view(
|
||||
&mut virtual_overseer,
|
||||
view![current],
|
||||
our_view![current],
|
||||
&validator_public,
|
||||
vec![ancestors[0]],
|
||||
hashmap! { current => 1 },
|
||||
@@ -768,7 +768,7 @@ fn not_a_live_candidate_is_detected() {
|
||||
|
||||
change_our_view(
|
||||
&mut virtual_overseer,
|
||||
view![current],
|
||||
our_view![current],
|
||||
&validator_public,
|
||||
vec![ancestors[0]],
|
||||
hashmap! { current => 1 },
|
||||
@@ -816,7 +816,7 @@ fn peer_change_view_before_us() {
|
||||
|
||||
change_our_view(
|
||||
&mut virtual_overseer,
|
||||
view![current],
|
||||
our_view![current],
|
||||
&validator_public,
|
||||
vec![ancestors[0]],
|
||||
hashmap! { current => 1 },
|
||||
@@ -863,7 +863,7 @@ fn candidate_chunks_are_put_into_message_vault_when_candidate_is_first_seen() {
|
||||
|
||||
change_our_view(
|
||||
&mut virtual_overseer,
|
||||
view![ancestors[0]],
|
||||
our_view![ancestors[0]],
|
||||
&validator_public,
|
||||
vec![ancestors[1]],
|
||||
hashmap! { ancestors[0] => 1 },
|
||||
@@ -879,7 +879,7 @@ fn candidate_chunks_are_put_into_message_vault_when_candidate_is_first_seen() {
|
||||
|
||||
change_our_view(
|
||||
&mut virtual_overseer,
|
||||
view![current],
|
||||
our_view![current],
|
||||
&validator_public,
|
||||
vec![ancestors[0]],
|
||||
hashmap! { current => 1 },
|
||||
@@ -1218,7 +1218,7 @@ fn new_peer_gets_all_chunks_send() {
|
||||
|
||||
change_our_view(
|
||||
&mut virtual_overseer,
|
||||
view![current],
|
||||
our_view![current],
|
||||
&validator_public,
|
||||
vec![ancestors[0]],
|
||||
hashmap! { current => 1 },
|
||||
|
||||
Reference in New Issue
Block a user