mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +00:00
Add lots of networking metrics for Prometheus (#5126)
* Add some metrics * Address concerns
This commit is contained in:
@@ -54,6 +54,8 @@ pub enum BehaviourOut<B: BlockT> {
|
||||
BlockImport(BlockOrigin, Vec<IncomingBlock<B>>),
|
||||
JustificationImport(Origin, B::Hash, NumberFor<B>, Justification),
|
||||
FinalityProofImport(Origin, B::Hash, NumberFor<B>, Vec<u8>),
|
||||
/// Started a random Kademlia discovery query.
|
||||
RandomKademliaStarted,
|
||||
Event(Event),
|
||||
}
|
||||
|
||||
@@ -96,6 +98,11 @@ impl<B: BlockT, H: ExHashT> Behaviour<B, H> {
|
||||
self.discovery.add_known_address(peer_id, addr)
|
||||
}
|
||||
|
||||
/// Returns the number of nodes that are in the Kademlia k-buckets.
|
||||
pub fn num_kbuckets_entries(&mut self) -> usize {
|
||||
self.discovery.num_kbuckets_entries()
|
||||
}
|
||||
|
||||
/// Borrows `self` and returns a struct giving access to the information about a node.
|
||||
///
|
||||
/// Returns `None` if we don't know anything about this node. Always returns `Some` for nodes
|
||||
@@ -216,6 +223,9 @@ impl<B: BlockT, H: ExHashT> NetworkBehaviourEventProcess<DiscoveryOut>
|
||||
DiscoveryOut::ValuePutFailed(key) => {
|
||||
self.events.push(BehaviourOut::Event(Event::Dht(DhtEvent::ValuePutFailed(key))));
|
||||
}
|
||||
DiscoveryOut::RandomKademliaStarted => {
|
||||
self.events.push(BehaviourOut::RandomKademliaStarted);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user