Add new VC metrics for beacon node availability (#3193)

## Issue Addressed

#3154 

## Proposed Changes

Add three new metrics for the VC:
1. `vc_beacon_nodes_synced_count`
2. `vc_beacon_nodes_available_count`
3. `vc_beacon_nodes_total_count`

Their values mirror the values present in the following log line:
```
Apr 08 17:25:17.000 INFO Connected to beacon node(s) synced: 4, available: 4, total: 4, service: notifier
```
This commit is contained in:
Mac L
2022-05-26 02:05:16 +00:00
parent f4aa17ef85
commit fd55373b88
3 changed files with 39 additions and 1 deletions

View File

@@ -40,8 +40,20 @@ async fn notify<T: SlotClock + 'static, E: EthSpec>(
log: &Logger,
) {
let num_available = duties_service.beacon_nodes.num_available().await;
set_gauge(
&http_metrics::metrics::AVAILABLE_BEACON_NODES_COUNT,
num_available as i64,
);
let num_synced = duties_service.beacon_nodes.num_synced().await;
set_gauge(
&http_metrics::metrics::SYNCED_BEACON_NODES_COUNT,
num_synced as i64,
);
let num_total = duties_service.beacon_nodes.num_total();
set_gauge(
&http_metrics::metrics::TOTAL_BEACON_NODES_COUNT,
num_total as i64,
);
if num_synced > 0 {
info!(
log,