fix(metrics): use AtomicU32 for drop counter to support MIPS targets
Also bumps version to 0.4.1.
This commit is contained in:
4 files changed
+10
-10
No files matched your search
Generated
+1
-1
@@ -392,7 +392,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sqm-autorate-rust"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"fastrand",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "sqm-autorate-rust"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
edition = "2024"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ use ::log::{debug, info};
|
||||
use std::collections::HashMap;
|
||||
use std::net::IpAddr;
|
||||
use std::str::FromStr;
|
||||
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
|
||||
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
|
||||
use std::sync::mpsc::{channel, sync_channel, RecvTimeoutError};
|
||||
use std::sync::{Arc, Mutex, RwLock};
|
||||
use std::thread::sleep;
|
||||
@@ -95,7 +95,7 @@ fn main() -> anyhow::Result<()> {
|
||||
let (error_tx, error_rx) = channel::<anyhow::Error>();
|
||||
let (reselect_tx, reselect_rx) = channel();
|
||||
|
||||
let dropped = Arc::new(AtomicU64::new(0));
|
||||
let dropped = Arc::new(AtomicU32::new(0));
|
||||
|
||||
let (metrics_tx, metrics_thread_handle) = if config.observability_enabled {
|
||||
let (tx, rx) = sync_channel(1000);
|
||||
|
||||
+6
-6
@@ -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)>,
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user