Skip to content

Commit

Permalink
Remove the never_attempted_alternate AddressBookMetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Nov 22, 2023
1 parent e519f26 commit c0a4c4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
15 changes: 1 addition & 14 deletions zebra-network/src/address_book.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ pub struct AddressMetrics {
/// The number of addresses in the `NeverAttemptedGossiped` state.
pub never_attempted_gossiped: usize,

/// The number of addresses in the `NeverAttemptedAlternate` state.
pub never_attempted_alternate: usize,

/// The number of addresses in the `Failed` state.
pub failed: usize,

Expand Down Expand Up @@ -680,7 +677,6 @@ impl AddressBook {
AddressMetrics {
responded,
never_attempted_gossiped,
never_attempted_alternate,
failed,
attempt_pending,
recently_live,
Expand All @@ -702,10 +698,6 @@ impl AddressBook {
// TODO: rename to address_book.[state_name]
metrics::gauge!("candidate_set.responded", m.responded as f64);
metrics::gauge!("candidate_set.gossiped", m.never_attempted_gossiped as f64);
metrics::gauge!(
"candidate_set.alternate",
m.never_attempted_alternate as f64,
);
metrics::gauge!("candidate_set.failed", m.failed as f64);
metrics::gauge!("candidate_set.pending", m.attempt_pending as f64);

Expand Down Expand Up @@ -751,12 +743,7 @@ impl AddressBook {

self.last_address_log = Some(now);
// if all peers have failed
if m.responded
+ m.attempt_pending
+ m.never_attempted_gossiped
+ m.never_attempted_alternate
== 0
{
if m.responded + m.attempt_pending + m.never_attempted_gossiped == 0 {
warn!(
address_metrics = ?m,
"all peer addresses have failed. Hint: check your network connection"
Expand Down
7 changes: 3 additions & 4 deletions zebra-network/src/address_book_updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,9 @@ impl AddressBookUpdater {
.set_pos(u64::try_from(address_info.num_addresses).expect("fits in u64"));
// .set_len(u64::try_from(address_info.address_limit).expect("fits in u64"));

let never_attempted = address_info.never_attempted_alternate
+ address_info.never_attempted_gossiped;

never_bar.set_pos(u64::try_from(never_attempted).expect("fits in u64"));
never_bar.set_pos(
u64::try_from(address_info.never_attempted_gossiped).expect("fits in u64"),
);
// .set_len(u64::try_from(address_info.address_limit).expect("fits in u64"));

failed_bar.set_pos(u64::try_from(address_info.failed).expect("fits in u64"));
Expand Down

0 comments on commit c0a4c4a

Please sign in to comment.