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()}")
}Output
2.0
pub(api) static fn histogram(name: str, help: str = "", buckets: List<f64> = [], labels: Map<str, str> = {:}) -> Histogram ioSince. 1.0.0-beta
Parameters
| Name | Type | Description |
|---|---|---|
name | str | |
help | str | default: "" |
buckets | List<f64> | upper bounds in the unit you observe; empty = latency buckets in seconds (100 us .. 10 s). default:[] |
labels | Map<str, str> | default: {:} |
Returns
Effects
io
Defined in: std/obs/obs.oxl:839