feat(metrics): track and report dropped metric counts

This commit is contained in:
Nils Andreas Svee committed 2026-04-13 18:57:50 +07:00
1 parent 451d42640b
commit 8036d27e6f
1 file changed
+5
+5
View File
@@ -189,6 +189,11 @@ impl Metrics {
match self.metrics_rx.recv_timeout(timeout) {
Ok(metric) => batch.push(metric),
Err(RecvTimeoutError::Timeout) => {
let dropped = self.metrics_dropped.swap(0, Ordering::Relaxed);
if dropped > 0 {
let ts = Time::new(ClockId::Realtime).as_nanos();
batch.push((Metric::Dropped { count: dropped }, ts));
}
if !batch.is_empty() {
self.flush(&mut transport, &batch, host_tag);
batch.clear();