feat/jaeger: more spans, more stages (#2477)

* feat/jaeger: more spans, more stages

Stage numbers are still arbitrarily picked.

* feat/jaeger: additional spans

* chore/spellcheck: improve the dictionary

* fix/jaeger JaegerSpan -> jaeger::Span
This commit is contained in:
Bernhard Schuster
2021-02-19 15:19:43 +01:00
committed by GitHub
parent a5defa7c7f
commit 49c6aa9a76
22 changed files with 249 additions and 143 deletions
+7 -7
View File
@@ -25,7 +25,7 @@ use std::{fmt, collections::HashMap};
pub use sc_network::PeerId;
#[doc(hidden)]
pub use polkadot_node_jaeger::JaegerSpan;
pub use polkadot_node_jaeger as jaeger;
#[doc(hidden)]
pub use std::sync::Arc;
@@ -118,16 +118,16 @@ macro_rules! impl_try_from {
/// Specialized wrapper around [`View`].
///
/// Besides the access to the view itself, it also gives access to the [`JaegerSpan`] per leave/head.
/// Besides the access to the view itself, it also gives access to the [`jaeger::Span`] per leave/head.
#[derive(Debug, Clone, Default)]
pub struct OurView {
view: View,
span_per_head: HashMap<Hash, Arc<JaegerSpan>>,
span_per_head: HashMap<Hash, Arc<jaeger::Span>>,
}
impl OurView {
/// Creates a new instance.
pub fn new(heads: impl IntoIterator<Item = (Hash, Arc<JaegerSpan>)>, finalized_number: BlockNumber) -> Self {
pub fn new(heads: impl IntoIterator<Item = (Hash, Arc<jaeger::Span>)>, finalized_number: BlockNumber) -> Self {
let state_per_head = heads.into_iter().collect::<HashMap<_, _>>();
Self {
@@ -142,7 +142,7 @@ impl OurView {
/// Returns the span per head map.
///
/// For each head there exists one span in this map.
pub fn span_per_head(&self) -> &HashMap<Hash, Arc<JaegerSpan>> {
pub fn span_per_head(&self) -> &HashMap<Hash, Arc<jaeger::Span>> {
&self.span_per_head
}
}
@@ -161,7 +161,7 @@ impl std::ops::Deref for OurView {
}
}
/// Construct a new [`OurView`] with the given chain heads, finalized number 0 and disabled [`JaegerSpan`]'s.
/// Construct a new [`OurView`] with the given chain heads, finalized number 0 and disabled [`jaeger::Span`]'s.
///
/// NOTE: Use for tests only.
///
@@ -176,7 +176,7 @@ impl std::ops::Deref for OurView {
macro_rules! our_view {
( $( $hash:expr ),* $(,)? ) => {
$crate::OurView::new(
vec![ $( $hash.clone() ),* ].into_iter().map(|h| (h, $crate::Arc::new($crate::JaegerSpan::Disabled))),
vec![ $( $hash.clone() ),* ].into_iter().map(|h| (h, $crate::Arc::new($crate::jaeger::Span::Disabled))),
0,
)
};