v0.34.0_1
This commit is contained in:
1 parent
9cfc4588cc
commit
f20c8da718
25 files changed
+694
-117
No files matched your search
@@ -1,5 +1,23 @@
|
||||
mod vhost_tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn exclusive_bins_reconstruct_exact_prometheus_cumulative_boundaries() {
|
||||
let m = VhostMetrics::default();
|
||||
m.active.store(5, Ordering::Relaxed);
|
||||
for micros in [1, 5_000, 5_001, 25_000, 5_000_001] {
|
||||
m.complete(200, false, std::time::Duration::from_micros(micros), 0, 1040);
|
||||
}
|
||||
let (cumulative, total) = m.duration_histogram();
|
||||
assert_eq!(total, 5);
|
||||
assert_eq!(cumulative, [2, 3, 4, 4, 4, 4, 4, 4, 4, 4]);
|
||||
assert_eq!(n(&m.buckets[0]), 2);
|
||||
assert_eq!(n(&m.buckets[1]), 1);
|
||||
assert_eq!(n(&m.buckets[2]), 1);
|
||||
assert_eq!(n(&m.buckets[10]), 1);
|
||||
assert_eq!(n(&m.completed), 5);
|
||||
assert_eq!(n(&m.active), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn streaming_completion_and_histogram() {
|
||||
let m = VhostMetrics::default();
|
||||
@@ -10,7 +28,12 @@ mod vhost_tests {
|
||||
assert_eq!(n(&m.status[4]), 1);
|
||||
assert_eq!(n(&m.buckets[1]), 0);
|
||||
assert_eq!(n(&m.buckets[2]), 1);
|
||||
assert_eq!(n(&m.buckets[10]), 1);
|
||||
assert_eq!(n(&m.buckets[10]), 0); // exclusive +Inf bin
|
||||
let (buckets, count) = m.duration_histogram();
|
||||
assert_eq!(buckets[1], 0);
|
||||
assert_eq!(buckets[2], 1);
|
||||
assert_eq!(buckets[9], 1);
|
||||
assert_eq!(count, 1);
|
||||
let view = m.view();
|
||||
assert_eq!(view.requests, 0);
|
||||
assert_eq!(view.completed, 1);
|
||||
|
||||
Reference in new issue
Block a user