mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
estimate the total inbound bandwidth of IDONTWANT messages in bytes (#6438)
* estimate the total inbound bandwidth of IDONTWANT messages
This commit is contained in:
@@ -3348,6 +3348,8 @@ where
|
|||||||
};
|
};
|
||||||
if let Some(metrics) = self.metrics.as_mut() {
|
if let Some(metrics) = self.metrics.as_mut() {
|
||||||
metrics.register_idontwant(message_ids.len());
|
metrics.register_idontwant(message_ids.len());
|
||||||
|
let idontwant_size = message_ids.iter().map(|id| id.0.len()).sum();
|
||||||
|
metrics.register_idontwant_bytes(idontwant_size);
|
||||||
}
|
}
|
||||||
for message_id in message_ids {
|
for message_id in message_ids {
|
||||||
peer.dont_send.insert(message_id, Instant::now());
|
peer.dont_send.insert(message_id, Instant::now());
|
||||||
|
|||||||
@@ -185,6 +185,9 @@ pub(crate) struct Metrics {
|
|||||||
/// The number of msg_id's we have received in every IDONTWANT control message.
|
/// The number of msg_id's we have received in every IDONTWANT control message.
|
||||||
idontwant_msgs_ids: Counter,
|
idontwant_msgs_ids: Counter,
|
||||||
|
|
||||||
|
/// The number of bytes we have received in every IDONTWANT control message.
|
||||||
|
idontwant_bytes: Counter,
|
||||||
|
|
||||||
/// The size of the priority queue.
|
/// The size of the priority queue.
|
||||||
priority_queue_size: Histogram,
|
priority_queue_size: Histogram,
|
||||||
/// The size of the non-priority queue.
|
/// The size of the non-priority queue.
|
||||||
@@ -338,6 +341,16 @@ impl Metrics {
|
|||||||
metric
|
metric
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let idontwant_bytes = {
|
||||||
|
let metric = Counter::default();
|
||||||
|
registry.register(
|
||||||
|
"idontwant_bytes",
|
||||||
|
"The total bytes we have received an IDONTWANT control messages",
|
||||||
|
metric.clone(),
|
||||||
|
);
|
||||||
|
metric
|
||||||
|
};
|
||||||
|
|
||||||
let memcache_misses = {
|
let memcache_misses = {
|
||||||
let metric = Counter::default();
|
let metric = Counter::default();
|
||||||
registry.register(
|
registry.register(
|
||||||
@@ -390,6 +403,7 @@ impl Metrics {
|
|||||||
memcache_misses,
|
memcache_misses,
|
||||||
topic_iwant_msgs,
|
topic_iwant_msgs,
|
||||||
idontwant_msgs,
|
idontwant_msgs,
|
||||||
|
idontwant_bytes,
|
||||||
idontwant_msgs_ids,
|
idontwant_msgs_ids,
|
||||||
priority_queue_size,
|
priority_queue_size,
|
||||||
non_priority_queue_size,
|
non_priority_queue_size,
|
||||||
@@ -589,6 +603,11 @@ impl Metrics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Register receiving the total bytes of an IDONTWANT control message.
|
||||||
|
pub(crate) fn register_idontwant_bytes(&mut self, bytes: usize) {
|
||||||
|
self.idontwant_bytes.inc_by(bytes as u64);
|
||||||
|
}
|
||||||
|
|
||||||
/// Register receiving an IDONTWANT msg for this topic.
|
/// Register receiving an IDONTWANT msg for this topic.
|
||||||
pub(crate) fn register_idontwant(&mut self, msgs: usize) {
|
pub(crate) fn register_idontwant(&mut self, msgs: usize) {
|
||||||
self.idontwant_msgs.inc();
|
self.idontwant_msgs.inc();
|
||||||
|
|||||||
Reference in New Issue
Block a user