mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-11-15 12:35:18 +00:00
33 lines
1.1 KiB
Rust
33 lines
1.1 KiB
Rust
|
use lighthouse_metrics::{try_create_int_counter, IntCounter, Result};
|
||
|
|
||
|
lazy_static! {
|
||
|
pub static ref SCRATCH_PAD_ITER_COUNT: Result<IntCounter> = try_create_int_counter(
|
||
|
"miner_scratch_pad_iter",
|
||
|
"Number of scratch pad iterations for PoRA"
|
||
|
);
|
||
|
pub static ref LOADING_COUNT: Result<IntCounter> = try_create_int_counter(
|
||
|
"miner_loading_iter",
|
||
|
"Number of loading iterations for PoRA"
|
||
|
);
|
||
|
pub static ref PAD_MIX_COUNT: Result<IntCounter> = try_create_int_counter(
|
||
|
"miner_mix_iter",
|
||
|
"Number of mix sealed data with scratch pad iterations for PoRA"
|
||
|
);
|
||
|
pub static ref HIT_COUNT: Result<IntCounter> =
|
||
|
try_create_int_counter("miner_hit", "Number of hit for PoRA");
|
||
|
}
|
||
|
|
||
|
pub fn report() -> String {
|
||
|
let s = |counter: &Result<IntCounter>| match counter {
|
||
|
Ok(x) => format!("{}", x.get()),
|
||
|
Err(_) => "n/a".to_string(),
|
||
|
};
|
||
|
format!(
|
||
|
"scratch pad: {}, loading: {}, pad_mix: {}, hit: {}",
|
||
|
s(&SCRATCH_PAD_ITER_COUNT),
|
||
|
s(&LOADING_COUNT),
|
||
|
s(&PAD_MIX_COUNT),
|
||
|
s(&HIT_COUNT)
|
||
|
)
|
||
|
}
|