Misc. dependency cleanup (#6810)

* remove ensure_dir_exists (2 deps saved)

* group UNHANDLED_ERRORs into a generic (2 deps saved)

* Introduce separate `health_metrics` crate

* separate health_metrics crate

* remove metrics from warp_utils

* move ProcessHealth::observe and SystemHealth::observe to health_metrics

* fix errors

* nitpick `Cargo.toml`s

---------

Co-authored-by: Daniel Knopik <daniel@dknopik.de>
# Conflicts:
#	Cargo.toml
This commit is contained in:
Daniel Knopik
2025-01-16 02:48:50 +01:00
committed by GitHub
parent b1a19a8b20
commit 669932aa67
43 changed files with 303 additions and 315 deletions

View File

@@ -5,7 +5,7 @@ use eth2::types::{Epoch, ValidatorStatus};
use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
use std::sync::Arc;
use warp_utils::reject::beacon_chain_error;
use warp_utils::reject::unhandled_error;
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
pub struct ValidatorCountResponse {
@@ -58,7 +58,7 @@ pub fn get_validator_count<T: BeaconChainTypes>(
}
Ok::<(), BeaconChainError>(())
})
.map_err(beacon_chain_error)?;
.map_err(unhandled_error)?;
Ok(ValidatorCountResponse {
active_ongoing,
@@ -101,7 +101,7 @@ pub fn get_validator_info<T: BeaconChainTypes>(
request_data: ValidatorInfoRequestData,
chain: Arc<BeaconChain<T>>,
) -> Result<ValidatorInfoResponse, warp::Rejection> {
let current_epoch = chain.epoch().map_err(beacon_chain_error)?;
let current_epoch = chain.epoch().map_err(unhandled_error)?;
let epochs = current_epoch.saturating_sub(HISTORIC_EPOCHS).as_u64()..=current_epoch.as_u64();