diff --git a/node/sync/src/auto_sync/batcher_random.rs b/node/sync/src/auto_sync/batcher_random.rs index 2578e2b..496b0ab 100644 --- a/node/sync/src/auto_sync/batcher_random.rs +++ b/node/sync/src/auto_sync/batcher_random.rs @@ -96,7 +96,7 @@ impl RandomBatcher { debug!(%tx_seq, ?sync_result, "Completed to sync file, state = {:?}", self.get_state().await); match sync_result { - SyncResult::Completed => metrics::RANDOM_SYNC_RESULT_COMPLETED.inc(1), + SyncResult::Completed => metrics::RANDOM_SYNC_RESULT_COMPLETED.mark(1), SyncResult::Failed => metrics::RANDOM_SYNC_RESULT_FAILED.inc(1), SyncResult::Timeout => metrics::RANDOM_SYNC_RESULT_TIMEOUT.inc(1), } diff --git a/node/sync/src/auto_sync/batcher_serial.rs b/node/sync/src/auto_sync/batcher_serial.rs index ff347ad..9322c72 100644 --- a/node/sync/src/auto_sync/batcher_serial.rs +++ b/node/sync/src/auto_sync/batcher_serial.rs @@ -257,7 +257,7 @@ impl SerialBatcher { info!(%tx_seq, ?sync_result, "Completed to sync file, state = {:?}", self.get_state().await); match sync_result { - SyncResult::Completed => metrics::SEQUENTIAL_SYNC_RESULT_COMPLETED.inc(1), + SyncResult::Completed => metrics::SEQUENTIAL_SYNC_RESULT_COMPLETED.mark(1), SyncResult::Failed => metrics::SEQUENTIAL_SYNC_RESULT_FAILED.inc(1), SyncResult::Timeout => metrics::SEQUENTIAL_SYNC_RESULT_TIMEOUT.inc(1), } diff --git a/node/sync/src/auto_sync/metrics.rs b/node/sync/src/auto_sync/metrics.rs index 39d9394..61d9c0f 100644 --- a/node/sync/src/auto_sync/metrics.rs +++ b/node/sync/src/auto_sync/metrics.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use metrics::{Counter, CounterUsize, Gauge, GaugeUsize, Histogram, Sample}; +use metrics::{register_meter, Counter, CounterUsize, Gauge, GaugeUsize, Histogram, Meter, Sample}; lazy_static::lazy_static! { // sequential auto sync @@ -9,8 +9,7 @@ lazy_static::lazy_static! { pub static ref SEQUENTIAL_STATE_TXS_PENDING: Arc = Sample::ExpDecay(0.015).register("sync_auto_sequential_state_txs_pending", 1024); pub static ref SEQUENTIAL_STATE_GAP_NEXT_DB: Arc> = GaugeUsize::register("sync_auto_sequential_state_gap_next_db"); - pub static ref SEQUENTIAL_SYNC_RESULT_TOTAL: Arc> = CounterUsize::register("sync_auto_sequential_sync_result_total"); - pub static ref SEQUENTIAL_SYNC_RESULT_COMPLETED: Arc> = CounterUsize::register("sync_auto_sequential_sync_result_completed"); + pub static ref SEQUENTIAL_SYNC_RESULT_COMPLETED: Arc = register_meter("sync_auto_sequential_sync_result_completed"); pub static ref SEQUENTIAL_SYNC_RESULT_FAILED: Arc> = CounterUsize::register("sync_auto_sequential_sync_result_failed"); pub static ref SEQUENTIAL_SYNC_RESULT_TIMEOUT: Arc> = CounterUsize::register("sync_auto_sequential_sync_result_timeout"); @@ -19,8 +18,7 @@ lazy_static::lazy_static! { pub static ref RANDOM_STATE_TXS_READY: Arc = Sample::ExpDecay(0.015).register("sync_auto_random_state_txs_ready", 1024); pub static ref RANDOM_STATE_TXS_PENDING: Arc = Sample::ExpDecay(0.015).register("sync_auto_random_state_txs_pending", 1024); - pub static ref RANDOM_SYNC_RESULT_TOTAL: Arc> = CounterUsize::register("sync_auto_random_sync_result_total"); - pub static ref RANDOM_SYNC_RESULT_COMPLETED: Arc> = CounterUsize::register("sync_auto_random_sync_result_completed"); + pub static ref RANDOM_SYNC_RESULT_COMPLETED: Arc = register_meter("sync_auto_random_sync_result_completed"); pub static ref RANDOM_SYNC_RESULT_FAILED: Arc> = CounterUsize::register("sync_auto_random_sync_result_failed"); pub static ref RANDOM_SYNC_RESULT_TIMEOUT: Arc> = CounterUsize::register("sync_auto_random_sync_result_timeout"); }