Skip to content

Commit

Permalink
Add ckb_freezer_number to ckb_metrics
Browse files Browse the repository at this point in the history
Signed-off-by: Eval EXEC <[email protected]>
  • Loading branch information
eval-exec committed Nov 21, 2024
1 parent fdc3a50 commit 7a84d5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions freezer/src/freezer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions util/metrics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -209,6 +211,7 @@ static METRICS: std::sync::LazyLock<Metrics> = 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"
Expand Down

0 comments on commit 7a84d5a

Please sign in to comment.