mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 15:05:40 +00:00
Add lots of networking metrics for Prometheus (#5126)
* Add some metrics * Address concerns
This commit is contained in:
@@ -518,6 +518,11 @@ impl Peerset {
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns the number of peers that we have discovered.
|
||||
pub fn num_discovered_peers(&self) -> usize {
|
||||
self.data.peers().len()
|
||||
}
|
||||
|
||||
/// Returns priority group by id.
|
||||
pub fn get_priority_group(&self, group_id: &str) -> Option<HashSet<PeerId>> {
|
||||
self.data.get_priority_group(group_id)
|
||||
|
||||
@@ -144,7 +144,7 @@ impl PeersState {
|
||||
/// Returns the list of all the peers we know of.
|
||||
// Note: this method could theoretically return a `Peer`, but implementing that
|
||||
// isn't simple.
|
||||
pub fn peers(&self) -> impl Iterator<Item = &PeerId> {
|
||||
pub fn peers(&self) -> impl ExactSizeIterator<Item = &PeerId> {
|
||||
self.nodes.keys()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user