promgleam/metrics/histogram
A histogram samples observations (usually things like request durations or response sizes) and counts them in configurable buckets. It also provides a sum of all observed values.
Functions
pub fn create_histogram(
registry registry: String,
name name: String,
help help: String,
labels labels: List(String),
buckets buckets: List(Float),
) -> Result(Nil, String)
Creates a new Histogram metric.
Examples
create_histogram(
registry: "default",
name: "http_request_duration_seconds",
help: "Duration of HTTP requests in seconds",
labels: [ "method", "route", "status" ],
buckets: [ 0.1, 0.25, 0.5, 1.0, 1.5 ],
)
pub fn observe_histogram(
registry registry: String,
name name: String,
labels labels: List(String),
value value: Float,
) -> Result(Nil, String)
Observes a value in the Histogram.
Examples
observe_histogram(
registry: "default",
name: "http_request_duration_seconds",
labels: [ "GET", "/", "200" ],
value: 0.23,
)