method metric.histogram
buckets: upper bounds in the unit you observe; empty = latency buckets in seconds (100 us .. 10 s).
Example:
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
Параметры
| Имя | Тип | Описание |
|---|---|---|
name | str | |
help | str | по умолчанию: "" |
buckets | List<f64> | upper bounds in the unit you observe; empty = latency buckets in seconds (100 us .. 10 s). по умолчанию:[] |
labels | Map<str, str> | по умолчанию: {:} |
Возвращает
Эффекты
io
Определено в: std/obs/obs.oxl:839