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

+12 -2
View File
@@ -243,8 +243,18 @@ impl Analytics {
}
pub fn push(&self, sample: Sample) {
if self.tx.try_send(sample).is_err() {
self.dropped.fetch_add(1, Ordering::Relaxed);
self.push_lazy(|| sample);
}
/// Acquire queue capacity before constructing owned analytics fields.
/// Overflow accounting is identical to `push`, and the queue remains
/// bounded. In saturated traffic the rejected sample allocates nothing.
pub fn push_lazy(&self, make_sample: impl FnOnce() -> Sample) {
match self.tx.try_reserve() {
Ok(permit) => permit.send(make_sample()),
Err(_) => {
self.dropped.fetch_add(1, Ordering::Relaxed);
}
}
}