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

data Gauge

A value that goes up and down (queue length, connections).

Example:

oxl✓ проверяется в CI
use std.obs { metric }

fn main() io {
  let g = metric.gauge("queue_length", "jobs waiting")
  g.set(5)
  g.dec()
  print("{g.value()}")
}
Вывод
4.0
pub(api) data Gauge

Потокобезопасность. safe from any task; updates are atomic.

С версии. 1.0.0-beta

Методы

set(v: f64) io
Sets the value.
add(n: f64) io
Adds n (may be negative).
inc() io
Adds 1.
dec() io
Subtracts 1.
value() -> f64 io
The current value.

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

См. также