Skip to content

Commit c81e0e2

Browse files
committed
Add larger request duration histogram bucket to better identify slow requests
1 parent 1644127 commit c81e0e2

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

quickwit/quickwit-search/src/metrics.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ pub struct SearchMetrics {
3838
pub searcher_local_kv_store_size_bytes: IntGauge,
3939
}
4040

41+
/// From 0.008s to 131.072s
42+
fn duration_buckets() -> Vec<f64> {
43+
exponential_buckets(0.008, 2.0, 15).unwrap()
44+
}
45+
4146
impl Default for SearchMetrics {
4247
fn default() -> Self {
4348
let targeted_splits_buckets: Vec<f64> = [
@@ -85,7 +90,7 @@ impl Default for SearchMetrics {
8590
"search",
8691
&[("kind", "server")],
8792
["status"],
88-
exponential_buckets(0.001, 2.0, 15).unwrap(),
93+
duration_buckets(),
8994
),
9095
root_search_targeted_splits: new_histogram_vec(
9196
"root_search_targeted_splits",
@@ -108,7 +113,7 @@ impl Default for SearchMetrics {
108113
"search",
109114
&[("kind", "server")],
110115
["status"],
111-
exponential_buckets(0.001, 2.0, 15).unwrap(),
116+
duration_buckets(),
112117
),
113118
leaf_search_targeted_splits: new_histogram_vec(
114119
"leaf_search_targeted_splits",
@@ -129,7 +134,7 @@ impl Default for SearchMetrics {
129134
"Number of seconds required to run a leaf search over a single split. The timer \
130135
starts after the semaphore is obtained.",
131136
"search",
132-
exponential_buckets(0.001, 2.0, 15).unwrap(),
137+
duration_buckets(),
133138
),
134139
leaf_search_single_split_tasks_ongoing: leaf_search_single_split_tasks
135140
.with_label_values(["ongoing"]),

quickwit/quickwit-serve/src/metrics.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ impl Default for ServeMetrics {
4848
"",
4949
&[],
5050
["method", "status_code"],
51-
quickwit_common::metrics::exponential_buckets(0.02, 2.0, 8).unwrap(),
51+
// last bucket is 163.84s
52+
quickwit_common::metrics::exponential_buckets(0.02, 2.0, 14).unwrap(),
5253
),
5354
ongoing_requests: new_gauge_vec(
5455
"ongoing_requests",
@@ -71,3 +72,19 @@ impl Default for ServeMetrics {
7172

7273
/// Serve counters exposes a bunch a set of metrics about the request received to quickwit.
7374
pub static SERVE_METRICS: Lazy<ServeMetrics> = Lazy::new(ServeMetrics::default);
75+
76+
#[cfg(test)]
77+
mod tests {
78+
79+
#[test]
80+
fn test_range() {
81+
println!(
82+
"{:?}",
83+
quickwit_common::metrics::exponential_buckets(0.008, 2.0, 15).unwrap()
84+
);
85+
println!(
86+
"{:?}",
87+
quickwit_common::metrics::exponential_buckets(0.02, 2.0, 14).unwrap()
88+
);
89+
}
90+
}

0 commit comments

Comments
 (0)