diff --git a/freezer/src/freezer.rs b/freezer/src/freezer.rs index c45dadc592..b9a668428c 100644 --- a/freezer/src/freezer.rs +++ b/freezer/src/freezer.rs @@ -126,6 +126,10 @@ impl Freezer { ); guard.tip = Some(block.header()); ckb_logger::trace!("Freezer block append {}", number); + + if let Some(metrics) = ckb_metrics::handle() { + metrics.ckb_freezer_number.set(number as i64); + } } else { ckb_logger::error!("Freezer block missing {}", number); break; diff --git a/util/metrics/src/lib.rs b/util/metrics/src/lib.rs index 6ea701f0e4..5dcda9724c 100644 --- a/util/metrics/src/lib.rs +++ b/util/metrics/src/lib.rs @@ -90,6 +90,8 @@ pub struct Metrics { pub ckb_freezer_size: IntGauge, /// Counter for measuring the effective amount of data read pub ckb_freezer_read: IntCounter, + /// Gauge for tracking the number of ckb_freezer + pub ckb_freezer_number: IntGauge, /// Counter for relay transaction short id collide pub ckb_relay_transaction_short_id_collide: IntCounter, /// Histogram for relay compact block verify duration @@ -209,6 +211,7 @@ static METRICS: std::sync::LazyLock = std::sync::LazyLock::new(|| { ), ckb_freezer_size: register_int_gauge!("ckb_freezer_size", "The CKB freezer size").unwrap(), ckb_freezer_read: register_int_counter!("ckb_freezer_read", "The CKB freezer read").unwrap(), + ckb_freezer_number: register_int_gauge!("ckb_freezer_number", "The CKB freezer number").unwrap(), ckb_relay_transaction_short_id_collide: register_int_counter!( "ckb_relay_transaction_short_id_collide", "The CKB relay transaction short id collide"