mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 07:17:56 +00:00
client/network: Expose number of entries per Kademlia bucket (#7104)
Extend `sub_libp2p_kbuckets_num_nodes` Prometheus metric to expose the number of nodes per bucket per Kademlia instance instead of only per Kademlia instance.
This commit is contained in:
@@ -1670,8 +1670,12 @@ impl<B: BlockT + 'static, H: ExHashT> Future for NetworkWorker<B, H> {
|
||||
this.is_major_syncing.store(is_major_syncing, Ordering::Relaxed);
|
||||
|
||||
if let Some(metrics) = this.metrics.as_ref() {
|
||||
for (proto, num_entries) in this.network_service.num_kbuckets_entries() {
|
||||
metrics.kbuckets_num_nodes.with_label_values(&[&proto.as_ref()]).set(num_entries as u64);
|
||||
for (proto, buckets) in this.network_service.num_entries_per_kbucket() {
|
||||
for (lower_ilog2_bucket_bound, num_entries) in buckets {
|
||||
metrics.kbuckets_num_nodes
|
||||
.with_label_values(&[&proto.as_ref(), &lower_ilog2_bucket_bound.to_string()])
|
||||
.set(num_entries as u64);
|
||||
}
|
||||
}
|
||||
for (proto, num_entries) in this.network_service.num_kademlia_records() {
|
||||
metrics.kademlia_records_count.with_label_values(&[&proto.as_ref()]).set(num_entries as u64);
|
||||
|
||||
Reference in New Issue
Block a user