Skip to content

Commit b57e5dc

Browse files
committed
feat(metrics): add batch_total timer to index_duration histogram
Add a batch_total label to the existing index_duration histogram that covers the full wall-clock time of each add+index cycle. This makes it easy to see per-batch throughput at a glance without summing the individual step histograms (add_process, add_write, index_lookup, index_process). Only recorded for batches where actual work is done (blocks not yet added or indexed), so no-op iterations do not skew the distribution.
1 parent 42104cd commit b57e5dc

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/new_index/schema.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,6 @@ impl Indexer {
374374
.cloned()
375375
.collect()
376376
};
377-
if !to_add.is_empty() {
378-
self.add(&to_add);
379-
}
380377

381378
// Index blocks not yet in history (O rows for to_add are now in the write buffer)
382379
let to_index: Vec<_> = {
@@ -387,8 +384,15 @@ impl Indexer {
387384
.cloned()
388385
.collect()
389386
};
390-
if !to_index.is_empty() {
391-
self.index(&to_index);
387+
388+
if !to_add.is_empty() || !to_index.is_empty() {
389+
let _batch_timer = self.start_timer("batch_total");
390+
if !to_add.is_empty() {
391+
self.add(&to_add);
392+
}
393+
if !to_index.is_empty() {
394+
self.index(&to_index);
395+
}
392396
}
393397
});
394398

0 commit comments

Comments
 (0)