feat: expose list read-dir amplification metrics (#5103)

Record local read_dir entry counts and duration for live-walker ListObjects scans so wide root/prefix amplification can be measured below the cross-set merge layer.

Add a focused LocalDisk scan_dir test showing a page limit of one still observes the whole parent directory enumeration, plus metric helper coverage.

Co-authored-by: heihutu <heihutu@gmail.com>
This commit is contained in:
houseme
2026-07-22 08:15:41 +08:00
committed by GitHub
parent 9469dfa5b8
commit a8e7cce5e1
4 changed files with 223 additions and 5 deletions
+15
View File
@@ -86,4 +86,19 @@ impl CapturingRecorder {
.map(|(_, samples)| samples.0.lock().expect("samples should be lockable").len())
.sum()
}
pub(crate) fn histogram_values(&self, name: &str, labels: &[(&str, &str)]) -> Vec<f64> {
self.histograms
.lock()
.expect("histogram map should be lockable")
.iter()
.filter(|(key, _)| {
key.name() == name
&& labels
.iter()
.all(|(lk, lv)| key.labels().any(|label| label.key() == *lk && label.value() == *lv))
})
.flat_map(|(_, samples)| samples.0.lock().expect("samples should be lockable").clone())
.collect()
}
}