Skip to content

Commit ecd486d

Browse files
committed
fix(consensus_manager): Do not discard download time metric and add send on reconnection metric
1 parent acb530c commit ecd486d

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

rs/p2p/consensus_manager/src/metrics.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ pub(crate) struct ConsensusManagerMetrics {
4141
pub send_view_consensus_dup_purge_total: IntCounter,
4242
pub send_view_send_to_peer_total: IntCounter,
4343
pub send_view_send_to_peer_delivered_total: IntCounter,
44+
pub send_view_resend_reconnect_total: IntCounter,
4445

4546
// Slot manager
4647
pub slot_manager_used_slots: IntGauge,
@@ -240,6 +241,14 @@ impl ConsensusManagerMetrics {
240241
))
241242
.unwrap(),
242243
),
244+
send_view_resend_reconnect_total: metrics_registry.register(
245+
IntCounter::with_opts(opts!(
246+
"ic_consensus_manager_send_view_resend_reconnect_total",
247+
"Artifact was sent again due to reconnection.",
248+
const_labels.clone(),
249+
))
250+
.unwrap(),
251+
),
243252

244253
slot_manager_used_slots: metrics_registry.register(
245254
IntGauge::with_opts(opts!(

rs/p2p/consensus_manager/src/receiver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ where
561561
.await?;
562562
}
563563

564-
timer.stop_and_discard();
564+
timer.stop_and_record();
565565

566566
result
567567
}

rs/p2p/consensus_manager/src/sender.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,15 @@ impl<Artifact: ArtifactKind> ConsensusManagerSender<Artifact> {
204204
// spawn task for peers with higher conn id or not in completed transmissions.
205205
// add task to join map
206206
for (peer, connection_id) in transport.peers() {
207-
let is_initiated = initiated_transmissions.get(&peer).is_some_and(|c| *c == connection_id);
207+
let is_initiated = initiated_transmissions.get(&peer).is_some_and(|c| {
208+
if *c == connection_id {
209+
true
210+
} else {
211+
metrics.send_view_resend_reconnect_total.inc();
212+
false
213+
}
214+
});
215+
208216

209217
if !is_initiated {
210218
metrics.send_view_send_to_peer_total.inc();

0 commit comments

Comments
 (0)