metrics_prometheus_client/metrics/
histogram.rs1use metrics::HistogramFn;
2
3const HIST_BUCKETS: [f64; 11] = [
4 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0,
5];
6
7#[derive(Debug)]
8pub struct MetricsHistogram {
9 pub(super) inner: prometheus_client::metrics::histogram::Histogram,
10}
11
12impl Default for MetricsHistogram {
13 fn default() -> Self {
14 Self {
16 inner: prometheus_client::metrics::histogram::Histogram::new(HIST_BUCKETS.into_iter()),
17 }
18 }
19}
20
21impl HistogramFn for MetricsHistogram {
22 fn record(&self, value: f64) {
23 self.inner.observe(value);
24 }
25}