Add http api endpoint

This commit is contained in:
Mac L
2023-08-01 13:38:22 +10:00
parent 6fc12e65de
commit c9bb547a1e
6 changed files with 56 additions and 15 deletions

View File

@@ -1,4 +1,5 @@
use crate::beacon_node_fallback::Config;
use serde_derive::{Deserialize, Serialize};
use slot_clock::SlotClock;
use std::cmp::Ordering;
use std::fmt::{Debug, Display, Formatter};
@@ -20,7 +21,7 @@ type HealthTier = u8;
type SyncDistance = Slot;
/// Helpful enum which is used when pattern matching to determine health tier.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
pub enum SyncDistanceTier {
Synced,
Small,
@@ -95,19 +96,19 @@ impl Default for BeaconNodeSyncDistanceTiers {
/// Execution Node health metrics.
///
/// Currently only considers `el_offline`.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
pub enum ExecutionEngineHealth {
Healthy,
Unhealthy,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
pub enum IsOptimistic {
Yes,
No,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
pub struct BeaconNodeHealthTier {
pub tier: HealthTier,
pub sync_distance: SyncDistance,
@@ -158,7 +159,7 @@ impl BeaconNodeHealthTier {
}
/// Beacon Node Health metrics.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
pub struct BeaconNodeHealth {
// The ID of the Beacon Node. This should correspond with its position in the `--beacon-nodes`
// list. Note that the ID field is used to tie-break nodes with the same health so that nodes