You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Increase the [`Counter`] by 1, returning the previous value.
pub fn inc(&self) -> N {
self.value.inc()
}
/// Increase the [`Counter`] by `v`, returning the previous value.
pub fn inc_by(&self, v: N) -> N {
self.value.inc_by(v)
}
which requires inc and inc_by to return the previous value. This is rarely needed for metric collecting use-case, and it hinders the ability to use per-thread thread-local accumulator to prevent contention (like this) and increase performance.
The text was updated successfully, but these errors were encountered:
I believe a thread local counter will benefit the performance. Considering a counter on each HTTP request, a shared lock is the last thing I want on my critical path.
Currently Counter's API is:
https://github.com/prometheus/client_rust/blob/master/src/metrics/counter.rs#L76-L83
which requires
inc
andinc_by
to return the previous value. This is rarely needed for metric collecting use-case, and it hinders the ability to use per-thread thread-local accumulator to prevent contention (like this) and increase performance.The text was updated successfully, but these errors were encountered: