mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 20:47:56 +00:00
Enforce that ProtocolId is a string (#6953)
* Enforce that ProtocolId is a string * Fix test
This commit is contained in:
@@ -1497,28 +1497,28 @@ impl<B: BlockT + 'static, H: ExHashT> Future for NetworkWorker<B, H> {
|
||||
Poll::Ready(SwarmEvent::Behaviour(BehaviourOut::AnsweredRequest { protocol, build_time, .. })) => {
|
||||
if let Some(metrics) = this.metrics.as_ref() {
|
||||
metrics.requests_in_total
|
||||
.with_label_values(&[&maybe_utf8_bytes_to_string(&protocol)])
|
||||
.with_label_values(&[&protocol])
|
||||
.observe(build_time.as_secs_f64());
|
||||
}
|
||||
},
|
||||
Poll::Ready(SwarmEvent::Behaviour(BehaviourOut::RequestStarted { protocol, .. })) => {
|
||||
if let Some(metrics) = this.metrics.as_ref() {
|
||||
metrics.requests_out_started_total
|
||||
.with_label_values(&[&maybe_utf8_bytes_to_string(&protocol)])
|
||||
.with_label_values(&[&protocol])
|
||||
.inc();
|
||||
}
|
||||
},
|
||||
Poll::Ready(SwarmEvent::Behaviour(BehaviourOut::RequestFinished { protocol, request_duration, .. })) => {
|
||||
if let Some(metrics) = this.metrics.as_ref() {
|
||||
metrics.requests_out_finished
|
||||
.with_label_values(&[&maybe_utf8_bytes_to_string(&protocol)])
|
||||
.with_label_values(&[&protocol])
|
||||
.observe(request_duration.as_secs_f64());
|
||||
}
|
||||
},
|
||||
Poll::Ready(SwarmEvent::Behaviour(BehaviourOut::RandomKademliaStarted(protocol))) => {
|
||||
if let Some(metrics) = this.metrics.as_ref() {
|
||||
metrics.kademlia_random_queries_total
|
||||
.with_label_values(&[&maybe_utf8_bytes_to_string(protocol.as_bytes())])
|
||||
.with_label_values(&[&protocol.as_ref()])
|
||||
.inc();
|
||||
}
|
||||
},
|
||||
@@ -1776,16 +1776,13 @@ impl<B: BlockT + 'static, H: ExHashT> Future for NetworkWorker<B, H> {
|
||||
if let Some(metrics) = this.metrics.as_ref() {
|
||||
metrics.is_major_syncing.set(is_major_syncing as u64);
|
||||
for (proto, num_entries) in this.network_service.num_kbuckets_entries() {
|
||||
let proto = maybe_utf8_bytes_to_string(proto.as_bytes());
|
||||
metrics.kbuckets_num_nodes.with_label_values(&[&proto]).set(num_entries as u64);
|
||||
metrics.kbuckets_num_nodes.with_label_values(&[&proto.as_ref()]).set(num_entries as u64);
|
||||
}
|
||||
for (proto, num_entries) in this.network_service.num_kademlia_records() {
|
||||
let proto = maybe_utf8_bytes_to_string(proto.as_bytes());
|
||||
metrics.kademlia_records_count.with_label_values(&[&proto]).set(num_entries as u64);
|
||||
metrics.kademlia_records_count.with_label_values(&[&proto.as_ref()]).set(num_entries as u64);
|
||||
}
|
||||
for (proto, num_entries) in this.network_service.kademlia_records_total_size() {
|
||||
let proto = maybe_utf8_bytes_to_string(proto.as_bytes());
|
||||
metrics.kademlia_records_sizes_total.with_label_values(&[&proto]).set(num_entries as u64);
|
||||
metrics.kademlia_records_sizes_total.with_label_values(&[&proto.as_ref()]).set(num_entries as u64);
|
||||
}
|
||||
metrics.peers_count.set(num_connected_peers as u64);
|
||||
metrics.peerset_num_discovered.set(this.network_service.user_protocol().num_discovered_peers() as u64);
|
||||
|
||||
Reference in New Issue
Block a user