Increase the number of buckets

This commit is contained in:
Tamo 2023-05-24 10:47:05 +02:00
parent 918ce1dd67
commit 57d53de402
2 changed files with 13 additions and 7 deletions

View file

@ -4,12 +4,19 @@ use prometheus::{
register_int_gauge_vec, HistogramVec, IntCounterVec, IntGauge, IntGaugeVec,
};
const HTTP_RESPONSE_TIME_CUSTOM_BUCKETS: &[f64; 14] = &[
0.0005, 0.0008, 0.00085, 0.0009, 0.00095, 0.001, 0.00105, 0.0011, 0.00115, 0.0012, 0.0015,
0.002, 0.003, 1.0,
];
/// Create evenly distributed buckets
fn create_buckets<const N: usize>() -> [f64; N] {
let mut array = [0.0; N];
for i in 0..N {
array[i] = ((i + 1) as f64) / N as f64;
}
array
}
lazy_static! {
pub static ref HTTP_RESPONSE_TIME_CUSTOM_BUCKETS: [f64; 100] = create_buckets();
pub static ref HTTP_REQUESTS_TOTAL: IntCounterVec = register_int_counter_vec!(
opts!("http_requests_total", "HTTP requests total"),
&["method", "path"]