@@ -353,9 +353,88 @@ lazy_static! {
353353 "beacon_attn_observation_epoch_aggregators" ,
354354 "Count of aggregators that have been seen by the beacon chain in the previous epoch"
355355 ) ;
356+ }
357+
358+ // Third lazy-static block is used to account for macro recursion limit.
359+ lazy_static ! {
360+ /*
361+ * Validator Monitor Metrics (per-epoch summaries)
362+ */
363+ pub static ref VALIDATOR_MONITOR_PREV_EPOCH_ATTESTATIONS_TOTAL : Result <IntGaugeVec > =
364+ try_create_int_gauge_vec(
365+ "validator_monitor_prev_epoch_attestations_total" ,
366+ "The number of unagg. attestations seen in the previous epoch." ,
367+ & [ "validator" ]
368+ ) ;
369+ pub static ref VALIDATOR_MONITOR_PREV_EPOCH_ATTESTATIONS_MIN_DELAY_SECONDS : Result <HistogramVec > =
370+ try_create_histogram_vec(
371+ "validator_monitor_prev_epoch_attestations_min_delay_seconds" ,
372+ "The min delay between then the validator should send the attestation and when it was received." ,
373+ & [ "validator" ]
374+ ) ;
375+ pub static ref VALIDATOR_MONITOR_PREV_EPOCH_ATTESTATION_AGGREGATE_INCLUSIONS : Result <IntGaugeVec > =
376+ try_create_int_gauge_vec(
377+ "validator_monitor_prev_epoch_attestation_aggregate_inclusions" ,
378+ "The count of times an attestation was seen inside an aggregate." ,
379+ & [ "validator" ]
380+ ) ;
381+ pub static ref VALIDATOR_MONITOR_PREV_EPOCH_ATTESTATION_BLOCK_INCLUSIONS : Result <IntGaugeVec > =
382+ try_create_int_gauge_vec(
383+ "validator_monitor_prev_epoch_attestation_block_inclusions" ,
384+ "The count of times an attestation was seen inside a block." ,
385+ & [ "validator" ]
386+ ) ;
387+ pub static ref VALIDATOR_MONITOR_PREV_EPOCH_ATTESTATION_BLOCK_MIN_INCLUSION_DISTANCE : Result <IntGaugeVec > =
388+ try_create_int_gauge_vec(
389+ "validator_monitor_prev_epoch_attestation_block_inclusion_distance" ,
390+ "The minimum inclusion distance observed for the inclusion of an attestation in a block." ,
391+ & [ "validator" ]
392+ ) ;
393+ pub static ref VALIDATOR_MONITOR_PREV_EPOCH_BEACON_BLOCKS_TOTAL : Result <IntGaugeVec > =
394+ try_create_int_gauge_vec(
395+ "validator_monitor_prev_epoch_beacon_blocks_total" ,
396+ "The number of beacon_blocks seen in the previous epoch." ,
397+ & [ "validator" ]
398+ ) ;
399+ pub static ref VALIDATOR_MONITOR_PREV_EPOCH_BEACON_BLOCKS_MIN_DELAY_SECONDS : Result <HistogramVec > =
400+ try_create_histogram_vec(
401+ "validator_monitor_prev_epoch_beacon_blocks_min_delay_seconds" ,
402+ "The min delay between then the validator should send the block and when it was received." ,
403+ & [ "validator" ]
404+ ) ;
405+ pub static ref VALIDATOR_MONITOR_PREV_EPOCH_AGGREGATES_TOTAL : Result <IntGaugeVec > =
406+ try_create_int_gauge_vec(
407+ "validator_monitor_prev_epoch_aggregates_total" ,
408+ "The number of aggregates seen in the previous epoch." ,
409+ & [ "validator" ]
410+ ) ;
411+ pub static ref VALIDATOR_MONITOR_PREV_EPOCH_AGGREGATES_MIN_DELAY_SECONDS : Result <HistogramVec > =
412+ try_create_histogram_vec(
413+ "validator_monitor_prev_epoch_aggregates_min_delay_seconds" ,
414+ "The min delay between then the validator should send the aggregate and when it was received." ,
415+ & [ "validator" ]
416+ ) ;
417+ pub static ref VALIDATOR_MONITOR_PREV_EPOCH_EXITS_TOTAL : Result <IntGaugeVec > =
418+ try_create_int_gauge_vec(
419+ "validator_monitor_prev_epoch_exits_total" ,
420+ "The number of exits seen in the previous epoch." ,
421+ & [ "validator" ]
422+ ) ;
423+ pub static ref VALIDATOR_MONITOR_PREV_EPOCH_PROPOSER_SLASHINGS_TOTAL : Result <IntGaugeVec > =
424+ try_create_int_gauge_vec(
425+ "validator_monitor_prev_epoch_proposer_slashings_total" ,
426+ "The number of proposer slashings seen in the previous epoch." ,
427+ & [ "validator" ]
428+ ) ;
429+ pub static ref VALIDATOR_MONITOR_PREV_EPOCH_ATTESTER_SLASHINGS_TOTAL : Result <IntGaugeVec > =
430+ try_create_int_gauge_vec(
431+ "validator_monitor_prev_epoch_attester_slashings_total" ,
432+ "The number of attester slashings seen in the previous epoch." ,
433+ & [ "validator" ]
434+ ) ;
356435
357436 /*
358- * Validator Monitor Metrics
437+ * Validator Monitor Metrics (real-time)
359438 */
360439 pub static ref VALIDATOR_MONITOR_VALIDATORS_TOTAL : Result <IntGauge > = try_create_int_gauge(
361440 "validator_monitor_validators_total" ,
@@ -456,10 +535,11 @@ pub fn scrape_for_metrics<T: BeaconChainTypes>(beacon_chain: &BeaconChain<T>) {
456535 & OP_POOL_NUM_VOLUNTARY_EXITS ,
457536 beacon_chain. op_pool . num_voluntary_exits ( ) ,
458537 ) ;
459- set_gauge_by_usize (
460- & VALIDATOR_MONITOR_VALIDATORS_TOTAL ,
461- beacon_chain. validator_monitor . read ( ) . num_validators ( ) ,
462- ) ;
538+
539+ beacon_chain
540+ . validator_monitor
541+ . read ( )
542+ . scrape_metrics ( & beacon_chain. slot_clock , & beacon_chain. spec ) ;
463543}
464544
465545/// Scrape the given `state` assuming it's the head state, updating the `DEFAULT_REGISTRY`.
0 commit comments