data metric
Namespace of the metric constructors. Names are Prometheus names ([a-zA-Z_:][a-zA-Z0-9_:]*); labels tell series of one
metric apart ({"route": "/pay"}). The same name and labels always give the same series. An invalid name is reported once
on stderr and the handle does nothing.
Example:
use std.obs { metric }
fn main() io {
let ok = metric.counter("http_requests_total", "requests", {"status": "200"})
let bad = metric.counter("http_requests_total", "requests", {"status": "500"})
ok.inc()
print("{ok.value()} {bad.value()}")
}Вывод
1.0 0.0
pub(api) data metricПотокобезопасность. safe from any task; the same name and labels always give the same series.
С версии. 1.0.0-beta
Методы
counter | (name: str, help: str, labels: Map<str, str>) -> Counter ioA counter (a value that only grows); name it ..._total. |
gauge | (name: str, help: str, labels: Map<str, str>) -> Gauge ioA gauge (a value that goes up and down). |
histogram | (name: str, help: str, buckets: List<f64>, labels: Map<str, str>) -> Histogram iobuckets: upper bounds in the unit you observe; empty = latency buckets in seconds (100 us .. |
Определено в: std/obs/obs.oxl:784