Skip to content

Commit

Permalink
Port of 3038 to testnet (#3066)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
ndr-ds authored Dec 20, 2024
1 parent 2c12eeb commit d5a4f5c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions linera-core/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ static NUM_BLOCKS: LazyLock<IntCounterVec> = LazyLock::new(|| {
.expect("Counter creation should not fail")
});

#[cfg(with_metrics)]
static CERTIFICATES_SIGNED: LazyLock<IntCounterVec> = 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 {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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))
}
Expand Down

0 comments on commit d5a4f5c

Please sign in to comment.