mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Replace lazy_static! with LazyLock (#6189)
* Replace `lazy_static` with `LazyLock`. * Merge branch 'unstable' into remove-lazy-static # Conflicts: # beacon_node/lighthouse_network/src/peer_manager/mod.rs * Lint fixes. * Merge branch 'unstable' into remove-lazy-static # Conflicts: # beacon_node/beacon_chain/src/metrics.rs * Moar lint fixes. * Update rust version to 1.80.0. * Merge branch 'unstable' into remove-lazy-static
This commit is contained in:
@@ -1,30 +1,41 @@
|
||||
pub use lighthouse_metrics::*;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
/*
|
||||
* Eth1 blocks
|
||||
*/
|
||||
pub static BLOCK_CACHE_LEN: LazyLock<Result<IntGauge>> =
|
||||
LazyLock::new(|| try_create_int_gauge("eth1_block_cache_len", "Count of eth1 blocks in cache"));
|
||||
pub static LATEST_CACHED_BLOCK_TIMESTAMP: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"eth1_latest_cached_block_timestamp",
|
||||
"Timestamp of latest block in eth1 cache",
|
||||
)
|
||||
});
|
||||
|
||||
lazy_static! {
|
||||
/*
|
||||
* Eth1 blocks
|
||||
*/
|
||||
pub static ref BLOCK_CACHE_LEN: Result<IntGauge> =
|
||||
try_create_int_gauge("eth1_block_cache_len", "Count of eth1 blocks in cache");
|
||||
pub static ref LATEST_CACHED_BLOCK_TIMESTAMP: Result<IntGauge> =
|
||||
try_create_int_gauge("eth1_latest_cached_block_timestamp", "Timestamp of latest block in eth1 cache");
|
||||
/*
|
||||
* Eth1 deposits
|
||||
*/
|
||||
pub static DEPOSIT_CACHE_LEN: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"eth1_deposit_cache_len",
|
||||
"Number of deposits in the eth1 cache",
|
||||
)
|
||||
});
|
||||
pub static HIGHEST_PROCESSED_DEPOSIT_BLOCK: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"eth1_highest_processed_deposit_block",
|
||||
"Number of the last block checked for deposits",
|
||||
)
|
||||
});
|
||||
|
||||
/*
|
||||
* Eth1 deposits
|
||||
*/
|
||||
pub static ref DEPOSIT_CACHE_LEN: Result<IntGauge> =
|
||||
try_create_int_gauge("eth1_deposit_cache_len", "Number of deposits in the eth1 cache");
|
||||
pub static ref HIGHEST_PROCESSED_DEPOSIT_BLOCK: Result<IntGauge> =
|
||||
try_create_int_gauge("eth1_highest_processed_deposit_block", "Number of the last block checked for deposits");
|
||||
/*
|
||||
* Eth1 rpc connection
|
||||
*/
|
||||
|
||||
/*
|
||||
* Eth1 rpc connection
|
||||
*/
|
||||
|
||||
pub static ref ETH1_CONNECTED: Result<IntGauge> = try_create_int_gauge(
|
||||
"sync_eth1_connected", "Set to 1 if connected to an eth1 node, otherwise set to 0"
|
||||
);
|
||||
|
||||
}
|
||||
pub static ETH1_CONNECTED: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"sync_eth1_connected",
|
||||
"Set to 1 if connected to an eth1 node, otherwise set to 0",
|
||||
)
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user