diff --git a/metrics-benchmark/Cargo.toml b/metrics-benchmark/Cargo.toml index 8bbdb876..21dfdaf5 100644 --- a/metrics-benchmark/Cargo.toml +++ b/metrics-benchmark/Cargo.toml @@ -12,6 +12,6 @@ pretty_env_logger = "0.4" getopts = "0.2" hdrhistogram = { version = "7.2", default-features = false } quanta = "0.10.0" -atomic-shim = "0.2" +portable-atomic = "0.3" metrics = { version = "^0.19", path = "../metrics" } metrics-util = { version = "^0.13", path = "../metrics-util" } diff --git a/metrics-benchmark/src/main.rs b/metrics-benchmark/src/main.rs index 0418bdf6..97d565f2 100644 --- a/metrics-benchmark/src/main.rs +++ b/metrics-benchmark/src/main.rs @@ -1,4 +1,3 @@ -use atomic_shim::AtomicU64; use getopts::Options; use hdrhistogram::Histogram as HdrHistogram; use log::{error, info}; @@ -7,6 +6,7 @@ use metrics::{ Counter, Gauge, Histogram, Key, KeyName, Recorder, SharedString, Unit, }; use metrics_util::registry::{AtomicStorage, Registry}; +use portable_atomic::AtomicU64; use quanta::{Clock, Instant as QuantaInstant}; use std::{ env, diff --git a/metrics-exporter-prometheus/Cargo.toml b/metrics-exporter-prometheus/Cargo.toml index 77ffc934..d49bdfd2 100644 --- a/metrics-exporter-prometheus/Cargo.toml +++ b/metrics-exporter-prometheus/Cargo.toml @@ -29,6 +29,7 @@ parking_lot = { version = "0.11", default-features = false } thiserror = { version = "1", default-features = false } quanta = { version = "0.10.0", default-features = false } indexmap = { version = "1", default-features = false } +portable-atomic = "0.3" # Optional hyper = { version = "0.14", default-features = false, features = ["tcp", "http1"], optional = true } diff --git a/metrics-exporter-prometheus/src/registry.rs b/metrics-exporter-prometheus/src/registry.rs index b82cba67..45fc8f29 100644 --- a/metrics-exporter-prometheus/src/registry.rs +++ b/metrics-exporter-prometheus/src/registry.rs @@ -1,4 +1,4 @@ -use std::sync::atomic::AtomicU64; +use portable_atomic::AtomicU64; use std::sync::Arc; use metrics::HistogramFn; diff --git a/metrics-util/Cargo.toml b/metrics-util/Cargo.toml index 70ef2c2e..c866aac3 100644 --- a/metrics-util/Cargo.toml +++ b/metrics-util/Cargo.toml @@ -50,7 +50,7 @@ required-features = ["handles"] metrics = { version = "^0.19", path = "../metrics" } crossbeam-epoch = { version = "0.9.2", default-features = false, optional = true, features = ["alloc", "std"] } crossbeam-utils = { version = "0.8", default-features = false, optional = true } -atomic-shim = { version = "0.2", default-features = false, optional = true } +portable-atomic = { version = "0.3", optional = true } aho-corasick = { version = "0.7", default-features = false, optional = true, features = ["std"] } indexmap = { version = "1", default-features = false, optional = true } parking_lot = { version = "0.11", default-features = false, optional = true } @@ -90,4 +90,4 @@ layer-filter = ["aho-corasick"] layer-router = ["radix_trie"] summary = ["sketches-ddsketch"] recency = ["parking_lot", "registry", "quanta"] -registry = ["atomic-shim", "crossbeam-epoch", "crossbeam-utils", "handles", "hashbrown", "num_cpus", "parking_lot"] +registry = ["portable-atomic", "crossbeam-epoch", "crossbeam-utils", "handles", "hashbrown", "num_cpus", "parking_lot"] diff --git a/metrics-util/src/registry/mod.rs b/metrics-util/src/registry/mod.rs index b1dd42bb..b4e2b29f 100644 --- a/metrics-util/src/registry/mod.rs +++ b/metrics-util/src/registry/mod.rs @@ -393,8 +393,8 @@ where #[cfg(test)] mod tests { - use atomic_shim::AtomicU64; use metrics::{CounterFn, Key}; + use portable_atomic::AtomicU64; use super::Registry; use std::sync::{atomic::Ordering, Arc}; diff --git a/metrics-util/src/registry/storage.rs b/metrics-util/src/registry/storage.rs index e115c872..a36ffe75 100644 --- a/metrics-util/src/registry/storage.rs +++ b/metrics-util/src/registry/storage.rs @@ -1,7 +1,7 @@ use std::sync::Arc; -use atomic_shim::AtomicU64; use metrics::{CounterFn, GaugeFn, HistogramFn}; +use portable_atomic::AtomicU64; use crate::AtomicBucket; diff --git a/metrics/Cargo.toml b/metrics/Cargo.toml index 439e85c3..5bec0ca2 100644 --- a/metrics/Cargo.toml +++ b/metrics/Cargo.toml @@ -28,7 +28,7 @@ harness = false [dependencies] metrics-macros = { version = "^0.5", path = "../metrics-macros" } ahash = { version = "0.7", default-features = false } -atomic-shim = "0.2" +portable-atomic = "0.3" [dev-dependencies] log = "0.4" diff --git a/metrics/src/handles.rs b/metrics/src/handles.rs index 0f22db45..fc129278 100644 --- a/metrics/src/handles.rs +++ b/metrics/src/handles.rs @@ -1,4 +1,4 @@ -use atomic_shim::AtomicU64; +use portable_atomic::AtomicU64; use std::sync::{atomic::Ordering, Arc}; use crate::IntoF64; diff --git a/metrics/src/key.rs b/metrics/src/key.rs index 42dbfda1..1c4033e9 100644 --- a/metrics/src/key.rs +++ b/metrics/src/key.rs @@ -1,7 +1,7 @@ use crate::{cow::Cow, IntoLabels, KeyHasher, Label, SharedString}; use alloc::{string::String, vec::Vec}; -use atomic_shim::AtomicU64; use core::{fmt, hash::Hash, slice::Iter}; +use portable_atomic::AtomicU64; use std::{ cmp, hash::Hasher,