mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +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:
@@ -18,7 +18,6 @@ derivative = { workspace = true }
|
||||
ethereum_ssz = { workspace = true }
|
||||
ethereum_ssz_derive = { workspace = true }
|
||||
flate2 = { version = "1.0.14", features = ["zlib"], default-features = false }
|
||||
lazy_static = { workspace = true }
|
||||
lighthouse_metrics = { workspace = true }
|
||||
filesystem = { workspace = true }
|
||||
lru = { workspace = true }
|
||||
|
||||
@@ -1,56 +1,78 @@
|
||||
use lazy_static::lazy_static;
|
||||
pub use lighthouse_metrics::*;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref SLASHER_DATABASE_SIZE: Result<IntGauge> = try_create_int_gauge(
|
||||
pub static SLASHER_DATABASE_SIZE: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"slasher_database_size",
|
||||
"Size of the database backing the slasher, in bytes"
|
||||
);
|
||||
pub static ref SLASHER_RUN_TIME: Result<Histogram> = try_create_histogram(
|
||||
"Size of the database backing the slasher, in bytes",
|
||||
)
|
||||
});
|
||||
pub static SLASHER_RUN_TIME: LazyLock<Result<Histogram>> = LazyLock::new(|| {
|
||||
try_create_histogram(
|
||||
"slasher_process_batch_time",
|
||||
"Time taken to process a batch of blocks and attestations"
|
||||
);
|
||||
pub static ref SLASHER_NUM_ATTESTATIONS_DROPPED: Result<IntGauge> = try_create_int_gauge(
|
||||
"Time taken to process a batch of blocks and attestations",
|
||||
)
|
||||
});
|
||||
pub static SLASHER_NUM_ATTESTATIONS_DROPPED: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"slasher_num_attestations_dropped",
|
||||
"Number of attestations dropped per batch"
|
||||
);
|
||||
pub static ref SLASHER_NUM_ATTESTATIONS_DEFERRED: Result<IntGauge> = try_create_int_gauge(
|
||||
"Number of attestations dropped per batch",
|
||||
)
|
||||
});
|
||||
pub static SLASHER_NUM_ATTESTATIONS_DEFERRED: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"slasher_num_attestations_deferred",
|
||||
"Number of attestations deferred per batch"
|
||||
);
|
||||
pub static ref SLASHER_NUM_ATTESTATIONS_VALID: Result<IntGauge> = try_create_int_gauge(
|
||||
"Number of attestations deferred per batch",
|
||||
)
|
||||
});
|
||||
pub static SLASHER_NUM_ATTESTATIONS_VALID: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"slasher_num_attestations_valid",
|
||||
"Number of valid attestations per batch"
|
||||
);
|
||||
pub static ref SLASHER_NUM_ATTESTATIONS_STORED_PER_BATCH: Result<IntGauge> =
|
||||
"Number of valid attestations per batch",
|
||||
)
|
||||
});
|
||||
pub static SLASHER_NUM_ATTESTATIONS_STORED_PER_BATCH: LazyLock<Result<IntGauge>> =
|
||||
LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"slasher_num_attestations_stored_per_batch",
|
||||
"Number of attestations stored per batch"
|
||||
);
|
||||
pub static ref SLASHER_NUM_BLOCKS_PROCESSED: Result<IntGauge> = try_create_int_gauge(
|
||||
"Number of attestations stored per batch",
|
||||
)
|
||||
});
|
||||
pub static SLASHER_NUM_BLOCKS_PROCESSED: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"slasher_num_blocks_processed",
|
||||
"Number of blocks processed per batch",
|
||||
);
|
||||
pub static ref SLASHER_NUM_CHUNKS_UPDATED: Result<IntCounterVec> = try_create_int_counter_vec(
|
||||
)
|
||||
});
|
||||
pub static SLASHER_NUM_CHUNKS_UPDATED: LazyLock<Result<IntCounterVec>> = LazyLock::new(|| {
|
||||
try_create_int_counter_vec(
|
||||
"slasher_num_chunks_updated",
|
||||
"Number of min or max target chunks updated on disk",
|
||||
&["array"],
|
||||
);
|
||||
pub static ref SLASHER_COMPRESSION_RATIO: Result<Gauge> = try_create_float_gauge(
|
||||
)
|
||||
});
|
||||
pub static SLASHER_COMPRESSION_RATIO: LazyLock<Result<Gauge>> = LazyLock::new(|| {
|
||||
try_create_float_gauge(
|
||||
"slasher_compression_ratio",
|
||||
"Compression ratio for min-max array chunks (higher is better)"
|
||||
);
|
||||
pub static ref SLASHER_NUM_ATTESTATION_ROOT_QUERIES: Result<IntCounter> =
|
||||
"Compression ratio for min-max array chunks (higher is better)",
|
||||
)
|
||||
});
|
||||
pub static SLASHER_NUM_ATTESTATION_ROOT_QUERIES: LazyLock<Result<IntCounter>> =
|
||||
LazyLock::new(|| {
|
||||
try_create_int_counter(
|
||||
"slasher_num_attestation_root_queries",
|
||||
"Number of requests for an attestation data root",
|
||||
);
|
||||
pub static ref SLASHER_NUM_ATTESTATION_ROOT_HITS: Result<IntCounter> = try_create_int_counter(
|
||||
)
|
||||
});
|
||||
pub static SLASHER_NUM_ATTESTATION_ROOT_HITS: LazyLock<Result<IntCounter>> = LazyLock::new(|| {
|
||||
try_create_int_counter(
|
||||
"slasher_num_attestation_root_hits",
|
||||
"Number of requests for an attestation data root that hit the LRU cache",
|
||||
);
|
||||
pub static ref SLASHER_ATTESTATION_ROOT_CACHE_SIZE: Result<IntGauge> = try_create_int_gauge(
|
||||
)
|
||||
});
|
||||
pub static SLASHER_ATTESTATION_ROOT_CACHE_SIZE: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"slasher_attestation_root_cache_size",
|
||||
"Number of attestation data roots cached in memory"
|
||||
);
|
||||
}
|
||||
"Number of attestation data roots cached in memory",
|
||||
)
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user