v0.34.0_1

This commit is contained in:
Mateusz Gruszczyński committed 2026-10-18 06:41:20 +02:00
1 parent 9cfc4588cc
commit f20c8da718
25 files changed
+694 -117

No files matched your search

+22
View File
@@ -42,6 +42,28 @@ mod tests {
assert_eq!(view.client_ips[0].count, 1);
}
#[tokio::test]
async fn saturated_analytics_queue_does_not_build_discarded_samples() {
let analytics = Analytics::start(CancellationToken::new());
let made = AtomicU64::new(0);
// No .await until the queue is filled: on this current-thread test
// runtime the consumer has not removed a sample in the background.
for _ in 0..(QUEUE_CAPACITY + 5) {
analytics.push_lazy(|| {
made.fetch_add(1, Ordering::Relaxed);
Sample {
vhost: "site".into(), route: None, method: "GET".into(),
path: "/".into(), client_ip: None, status: 200,
duration_ms: 1, request_bytes: 0, response_bytes: 1040,
cache: "BYPASS", source: "reverse_proxy",
user_agent: None, country: None,
}
});
}
assert_eq!(made.load(Ordering::Relaxed), QUEUE_CAPACITY as u64);
assert_eq!(analytics.dropped.load(Ordering::Relaxed), 5);
}
#[test]
fn prometheus_dimensions_are_fixed_cardinality() {
assert_eq!(method_family("GET"), "GET");