mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 20:57:59 +00:00
add network propagated metrics (#6438)
This commit is contained in:
@@ -48,7 +48,7 @@ use sp_runtime::traits::{
|
||||
use sp_arithmetic::traits::SaturatedConversion;
|
||||
use message::{BlockAnnounce, Message};
|
||||
use message::generic::{Message as GenericMessage, ConsensusMessage, Roles};
|
||||
use prometheus_endpoint::{Registry, Gauge, GaugeVec, HistogramVec, PrometheusError, Opts, register, U64};
|
||||
use prometheus_endpoint::{Registry, Gauge, Counter, GaugeVec, HistogramVec, PrometheusError, Opts, register, U64};
|
||||
use sync::{ChainSync, SyncState};
|
||||
use std::borrow::Cow;
|
||||
use std::collections::{BTreeMap, HashMap, HashSet, VecDeque};
|
||||
@@ -145,6 +145,7 @@ struct Metrics {
|
||||
fork_targets: Gauge<U64>,
|
||||
finality_proofs: GaugeVec<U64>,
|
||||
justifications: GaugeVec<U64>,
|
||||
propagated_extrinsics: Counter<U64>,
|
||||
}
|
||||
|
||||
impl Metrics {
|
||||
@@ -190,6 +191,10 @@ impl Metrics {
|
||||
)?;
|
||||
register(g, r)?
|
||||
},
|
||||
propagated_extrinsics: register(Counter::new(
|
||||
"sync_propagated_extrinsics",
|
||||
"Number of transactions propagated to at least one peer",
|
||||
)?, r)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1237,6 +1242,12 @@ impl<B: BlockT, H: ExHashT> Protocol<B, H> {
|
||||
}
|
||||
}
|
||||
|
||||
if propagated_to.len() > 0 {
|
||||
if let Some(ref metrics) = self.metrics {
|
||||
metrics.propagated_extrinsics.inc();
|
||||
}
|
||||
}
|
||||
|
||||
propagated_to
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user