Skip to content

Commit

Permalink
storage: add _num_rounds_window_compaction to probe
Browse files Browse the repository at this point in the history
A metric that measures the number of rounds of sliding window compaction
that have been driven to completion.
  • Loading branch information
WillemKauf committed Dec 3, 2024
1 parent 04812f9 commit ce8d016
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/v/storage/disk_log_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ segment_set disk_log_impl::find_sliding_range(
config().ntp(),
_last_compaction_window_start_offset.value(),
_segs.front()->offsets().get_base_offset());

_probe->add_sliding_window_round_complete();
_last_compaction_window_start_offset.reset();
}

Expand Down Expand Up @@ -687,7 +687,7 @@ ss::future<bool> disk_log_impl::sliding_window_compact(
"{}, resetting sliding window start offset",
config().ntp(),
idx_start_offset);

_probe->add_sliding_window_round_complete();
next_window_start_offset.reset();
}

Expand Down
6 changes: 6 additions & 0 deletions src/v/storage/probe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ void probe::setup_metrics(const model::ntp& ntp) {
sm::description("Number of segments that have been verified through "
"the compaction process to be tombstone free."),
labels),
sm::make_counter(
"complete_sliding_window_rounds",
[this] { return _num_rounds_window_compaction; },
sm::description("Number of rounds of sliding window compaction that "
"have been driven to completion."),
labels),
},
{},
{sm::shard_label, partition_label});
Expand Down
4 changes: 4 additions & 0 deletions src/v/storage/probe.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ class probe {
void add_segment_marked_tombstone_free() {
++_segments_marked_tombstone_free;
}
void add_sliding_window_round_complete() {
++_num_rounds_window_compaction;
}

void batch_parse_error() { ++_batch_parse_errors; }

Expand Down Expand Up @@ -146,6 +149,7 @@ class probe {
uint64_t _tombstones_removed = 0;
uint64_t _segment_cleanly_compacted = 0;
uint64_t _segments_marked_tombstone_free = 0;
uint64_t _num_rounds_window_compaction = 0;

ssize_t _compaction_removed_bytes = 0;

Expand Down

0 comments on commit ce8d016

Please sign in to comment.