OxL Reference

method metric.histogram

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

Example:

oxl✓ checked in 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()}")
}
Output
2.0
pub(api) static fn histogram(name: str, help: str = "", buckets: List<f64> = [], labels: Map<str, str> = {:}) -> Histogram  io

Since. 1.0.0-beta

Parameters

NameTypeDescription
namestr
helpstrdefault: ""
bucketsList<f64>

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

default: []
labelsMap<str, str>default: {:}

Returns

Histogram

Effects

io

Defined in: std/obs/obs.oxl:839

See also