data Counter
A value that only grows (requests served, errors). Name it …_total.
Example:
use std.obs { metric }
fn main() io {
let c = metric.counter("requests_total", "requests served")
c.inc()
c.add(2)
print("{c.value()}")
}Вывод
3.0
pub(api) data CounterПотокобезопасность. safe from any task; updates are atomic.
С версии. 1.0.0-beta
Методы
inc | () ioAdds 1. |
add | (n: f64) ioAdds n (>= 0; a negative amount is ignored). |
value | () -> f64 ioCurrent value. |
Определено в: std/obs/obs.oxl:518