Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax atomic operations of update_gauge and increment_counter #184

Merged
merged 1 commit into from
Mar 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions metrics-util/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Handle {
pub fn increment_counter(&self, value: u64) {
match self {
Handle::Counter(counter) => {
counter.fetch_add(value, Ordering::SeqCst);
counter.fetch_add(value, Ordering::Relaxed);
}
_ => panic!("tried to increment as counter"),
}
Expand All @@ -60,7 +60,7 @@ impl Handle {
pub fn update_gauge(&self, value: GaugeValue) {
match self {
Handle::Gauge(gauge) => {
let _ = gauge.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |curr| {
let _ = gauge.fetch_update(Ordering::AcqRel, Ordering::Relaxed, |curr| {
tobz marked this conversation as resolved.
Show resolved Hide resolved
let input = f64::from_bits(curr);
let output = value.update_value(input);
Some(output.to_bits())
Expand Down