method metric.counter
A counter (a value that only grows); name it ..._total. The same name and labels give the same series.
Example:
use std.obs { metric }
fn main() io {
let c = metric.counter("requests_total", "requests served")
c.inc()
c.add(2.0)
print("{c.value()}")
}Вывод
3.0
pub(api) static fn counter(name: str, help: str = "", labels: Map<str, str> = {:}) -> Counter ioС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
name | str |
help | str = "" |
labels | Map<str, str> = {:} |
Возвращает
Эффекты
io
Определено в: std/obs/obs.oxl:803