Revert libp2p metrics (#4870) (#5265)

* Revert "improve libp2p connected peer metrics (#4870)"

This reverts commit 0c3fef59b3.
This commit is contained in:
Jimmy Chen
2024-02-20 15:19:17 +11:00
committed by GitHub
parent a229b52723
commit 50c423ad88
7 changed files with 100 additions and 65 deletions

View File

@@ -244,16 +244,6 @@ pub fn inc_counter_vec(int_counter_vec: &Result<IntCounterVec>, name: &[&str]) {
}
}
/// Sets the `int_counter_vec` with the given `name` to the `amount`,
/// should only be called with `ammount`s equal or above the current value
/// as per Prometheus spec, the `counter` type should only go up.
pub fn set_counter_vec_by(int_counter_vec: &Result<IntCounterVec>, name: &[&str], amount: u64) {
if let Some(counter) = get_int_counter(int_counter_vec, name) {
counter.reset();
counter.inc_by(amount);
}
}
pub fn inc_counter_vec_by(int_counter_vec: &Result<IntCounterVec>, name: &[&str], amount: u64) {
if let Some(counter) = get_int_counter(int_counter_vec, name) {
counter.inc_by(amount);