From 9a2c545755c968aaa542017cc0dd367e9d319b8e Mon Sep 17 00:00:00 2001 From: phil Date: Wed, 22 Jul 2026 13:43:33 -0400 Subject: [PATCH] metrics for resynced bytes by ingest/batch-put --- hubble/src/metrics.rs | 2 ++ hubble/src/sync.rs | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hubble/src/metrics.rs b/hubble/src/metrics.rs index 6dfa79e..bb447dd 100644 --- a/hubble/src/metrics.rs +++ b/hubble/src/metrics.rs @@ -11,6 +11,8 @@ const POLLED_METRICS_INTERVAL: Duration = Duration::from_secs(15); const TOTAL_RECORDS: &str = "hubble_total_records"; const RESIDENT_MEMORY: &str = "hubble_resident_memory"; +pub const RESYNC_GENERATIONS_OVERFLOW: &str = "hubble_resync_generation_overflow"; +pub const RESYNC_TOTAL_BLOCK_BYTES: &str = "hubble_resync_total_block_bytes"; pub const REPO_SST_INGESTIONS: &str = "hubble_repo_sst_ingests_total"; pub async fn run_gauges( diff --git a/hubble/src/sync.rs b/hubble/src/sync.rs index 253f0a2..b5d6b32 100644 --- a/hubble/src/sync.rs +++ b/hubble/src/sync.rs @@ -1,5 +1,5 @@ use crate::Hubble; -use crate::metrics::REPO_SST_INGESTIONS; +use crate::metrics::{REPO_SST_INGESTIONS, RESYNC_GENERATIONS_OVERFLOW, RESYNC_TOTAL_BLOCK_BYTES}; use crate::store::{CommitState, InfoState, counts, record, repo_sst_opts}; use hubble_sync::{ AccountStatus, AppResult, Commit, ConsumerAppError, RepoContext, RepoSlots, ResyncData, @@ -76,7 +76,7 @@ impl StatefulSyncConsumer for Hubble { if overflowed { // overflow is fine! we only ever use current and next debug!("resync generation overflow"); - metrics::counter!("hubble_resync_generation_overflow").increment(1); + metrics::counter!(RESYNC_GENERATIONS_OVERFLOW).increment(1); } // first: clear next gen in case of previous partial resync @@ -91,6 +91,8 @@ impl StatefulSyncConsumer for Hubble { // put-per-key for small ones if data.total_block_bytes() as usize > self.repo_sst_ingest_threshold { // big repo: sst ingest + metrics::counter!(RESYNC_TOTAL_BLOCK_BYTES, "method" => "ingest_sst") + .increment(data.total_block_bytes() as u64); metrics::counter!(REPO_SST_INGESTIONS).increment(1); let path = self.repo_sst_ingest_staging_dir.join(format!( "repo-{}.sst", @@ -120,6 +122,8 @@ impl StatefulSyncConsumer for Hubble { } } else { // normal-sized repo: batched puts + metrics::counter!(RESYNC_TOTAL_BLOCK_BYTES, "method" => "batched_put") + .increment(data.total_block_bytes() as u64); while let Some(chunk) = data.walk.next_chunk(RESYNC_CHUNK)? { let mut local_batch = WriteBatch::default(); for rec in chunk { -- 2.51.2