Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add propagated transactions counter to network #6438

Merged
merged 1 commit into from
Jun 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion client/network/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -145,6 +145,7 @@ struct Metrics {
fork_targets: Gauge<U64>,
finality_proofs: GaugeVec<U64>,
justifications: GaugeVec<U64>,
propagated_extrinsics: Counter<U64>,
}

impl Metrics {
Expand Down Expand Up @@ -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)?,
})
}
}
Expand Down Expand Up @@ -1232,6 +1237,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
}

Expand Down