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

method metric.histogram

buckets: upper bounds in the unit you observe; empty = latency buckets in seconds (100 us .. 10 s).

Example:

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

fn main() io {
  let h = metric.histogram("latency_seconds", "request latency", [0.1, 0.5, 1.0])
  h.observe(0.3)
  h.observe(0.7)
  print("{h.count()}")
}
Вывод
2.0
pub(api) static fn histogram(name: str, help: str = "", buckets: List<f64> = [], labels: Map<str, str> = {:}) -> Histogram  io

С версии. 1.0.0-beta

Параметры

ИмяТипОписание
namestr
helpstrпо умолчанию: ""
bucketsList<f64>

upper bounds in the unit you observe; empty = latency buckets in seconds (100 us .. 10 s).

по умолчанию: []
labelsMap<str, str>по умолчанию: {:}

Возвращает

Histogram

Эффекты

io

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

См. также