From d5a4f5c67f69b392528f1833acb23dde1db87690 Mon Sep 17 00:00:00 2001 From: Andre da Silva <2917611+ndr-ds@users.noreply.github.com> Date: Thu, 19 Dec 2024 21:57:58 -0300 Subject: [PATCH] Port of 3038 to testnet (#3066) ## Motivation TSIA, this is a port of 3038 + 3058 (which are just comments I forgot to address from 3038) ## Proposal Cherry picked the commits ## Test Plan CI ## Release Plan - Nothing to do / These changes follow the usual release cycle. --- linera-core/src/worker.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/linera-core/src/worker.rs b/linera-core/src/worker.rs index fe61eb08714..98cb71c0d4a 100644 --- a/linera-core/src/worker.rs +++ b/linera-core/src/worker.rs @@ -91,6 +91,16 @@ static NUM_BLOCKS: LazyLock = LazyLock::new(|| { .expect("Counter creation should not fail") }); +#[cfg(with_metrics)] +static CERTIFICATES_SIGNED: LazyLock = LazyLock::new(|| { + prometheus_util::register_int_counter_vec( + "certificates_signed", + "Number of confirmed block certificates signed by each validator", + &["validator_name"], + ) + .expect("Counter creation should not fail") +}); + /// Instruct the networking layer to send cross-chain requests and/or push notifications. #[derive(Default, Debug)] pub struct NetworkActions { @@ -762,6 +772,8 @@ where false, ); + #[cfg(with_metrics)] + let certificate_signatures = certificate.signatures().clone(); let (info, actions) = match certificate.value() { CertificateValue::ValidatedBlock { .. } => { // Confirm the validated block. @@ -806,6 +818,12 @@ where .with_label_values(&[]) .inc_by(confirmed_transactions); } + + for (validator_name, _) in certificate_signatures { + CERTIFICATES_SIGNED + .with_label_values(&[&validator_name.to_string()]) + .inc(); + } } Ok((info, actions)) }