Fix validator_monitor_prev_epoch_ metrics (#2911)

## Issue Addressed

#2820

## Proposed Changes

The problem is that validator_monitor_prev_epoch metrics are updated only if there is EpochSummary present in summaries map for the previous epoch and it is not the case for the offline validator. Ensure that EpochSummary is inserted into summaries map also for the offline validators.
This commit is contained in:
eklm 2022-06-20 04:06:30 +00:00
parent f428719761
commit a9e158663b

View File

@ -231,6 +231,11 @@ impl MonitoredValidator {
}
}
}
/// Ensure epoch summary is added to the summaries map
fn touch_epoch_summary(&self, epoch: Epoch) {
self.with_epoch_summary(epoch, |_| {});
}
}
/// Holds a collection of `MonitoredValidator` and is notified about a variety of events on the P2P
@ -306,6 +311,7 @@ impl<T: EthSpec> ValidatorMonitor<T> {
// Update metrics for individual validators.
for monitored_validator in self.validators.values() {
if let Some(i) = monitored_validator.index {
monitored_validator.touch_epoch_summary(current_epoch);
let i = i as usize;
let id = &monitored_validator.id;