OxL Справочник OxL
РусскийEnglish

method metric.counter

A counter (a value that only grows); name it ..._total. The same name and labels give the same series.

Example:

oxl✓ проверяется в CI
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

Параметры

ИмяТип
namestr
helpstr = ""
labelsMap<str, str> = {:}

Возвращает

Counter

Эффекты

io

Определено в: std/obs/obs.oxl:803

См. также