fix(metrics): use AtomicU32 for drop counter to support MIPS targets

Also bumps version to 0.4.1.
This commit is contained in:
Nils Andreas Svee committed 2026-04-14 02:14:55 +07:00
1 parent 99e80c381d
commit 8739ed4419
4 files changed
+10 -10

No files matched your search

+6 -6
View File
@@ -5,7 +5,7 @@ use log::{error, info, warn};
use rustix::time::ClockId;
use std::fmt::Write;
use std::net::{IpAddr, TcpStream, UdpSocket};
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::mpsc::{Receiver, RecvTimeoutError, SyncSender};
use std::sync::Arc;
use std::time::Duration;
@@ -116,18 +116,18 @@ pub enum Metric {
tags: &'static [(&'static str, &'static str)],
},
Dropped {
count: u64,
count: u32,
},
}
#[derive(Clone)]
pub struct MetricsSender {
tx: Option<SyncSender<(Metric, u64)>>,
dropped: Arc<AtomicU64>,
dropped: Arc<AtomicU32>,
}
impl MetricsSender {
pub fn new(tx: SyncSender<(Metric, u64)>, dropped: Arc<AtomicU64>) -> Self {
pub fn new(tx: SyncSender<(Metric, u64)>, dropped: Arc<AtomicU32>) -> Self {
Self {
tx: Some(tx),
dropped,
@@ -137,7 +137,7 @@ impl MetricsSender {
pub fn disabled() -> Self {
Self {
tx: None,
dropped: Arc::new(AtomicU64::new(0)),
dropped: Arc::new(AtomicU32::new(0)),
}
}
@@ -153,7 +153,7 @@ impl MetricsSender {
pub struct Metrics {
pub config: Config,
pub metrics_dropped: Arc<AtomicU64>,
pub metrics_dropped: Arc<AtomicU32>,
pub metrics_rx: Receiver<(Metric, u64)>,
}