mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-28 07:57:01 +00:00
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:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user