fn log_metrics(&mut self, m: &AddressMetrics, now: Instant) {
        let _guard = self.span.enter();

        trace!(
            address_metrics = ?m,
        );

        if m.responded > 0 {
            return;
        }

        // These logs are designed to be human-readable in a terminal, at the
        // default Zebra log level. If you need to know address states for
        // every request, use the trace-level logs, or the metrics exporter.
        if let Some(last_address_log) = self.last_address_log {
            // Avoid duplicate address logs
            if now.saturating_duration_since(last_address_log).as_secs() < 60 {
                return;
            }
        } else {
            // Suppress initial logs until the peer set has started up.
            // There can be multiple address changes before the first peer has
            // responded.
            self.last_address_log = Some(now);
            return;
        }

        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
        {
            warn!(
                address_metrics = ?m,
                "all peer addresses have failed. Hint: check your network connection"
            );
        } else {
            info!(
                address_metrics = ?m,
                "no active peer connections: trying gossiped addresses"
            );
        }
    }
/// Log metrics for this address book
Log metrics for this address book
Log metrics for this address book
fn log_metrics(&mut self, m: &AddressMetrics, now: Instant) {
        let _guard = self.span.enter();
        trace!(
            address_metrics = ?m,
        );
        if m.responded > 0 {
            return;
        }
        // These logs are designed to be human-readable in a terminal, at the
        // default Zebra log level. If you need to know address states for
        // every request, use the trace-level logs, or the metrics exporter.
        if let Some(last_address_log) = self.last_address_log {
            // Avoid duplicate address logs
            if now.saturating_duration_since(last_address_log).as_secs() < 60 {
                return;
            }
        } else {
            // Suppress initial logs until the peer set has started up.
            // There can be multiple address changes before the first peer has
            // responded.
            self.last_address_log = Some(now);
            return;
        }
        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
        {
            warn!(
                address_metrics = ?m,
                "all peer addresses have failed. Hint: check your network connection"
            );
        } else {
            info!(
                address_metrics = ?m,
                "no active peer connections: trying gossiped addresses"
            );
        }
    }
fn log_metrics ( & mut self , m : & AddressMetrics , now : Instant ) { let _guard = self . span . enter ( ) ; trace ! ( address_metrics m ) ; if m . responded > 0 { return ; } // These logs are designed to be human-readable in a terminal, at the // default Zebra log level. If you need to know address states for // every request, use the trace-level logs, or the metrics exporter. if let Some ( last_address_log ) = self . last_address_log { // Avoid duplicate address logs if now . saturating_duration_since ( last_address_log ) . as_secs ( ) < 60 { return ; } } else { // Suppress initial logs until the peer set has started up. // There can be multiple address changes before the first peer has // responded. self . last_address_log = Some ( now ) ; return ; } 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 { warn ! ( address_metrics m " " ) ; } else { info ! ( address_metrics m " " ) ; } }
Log metrics for this address book
Log metrics for this address book
&mut self
m
&AddressMetrics
now
Instant