Skip to content

Commit 5f9b60b

Browse files
Corrections to prometheus entries. (#2470)
1 parent f293c2e commit 5f9b60b

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

linera-views/src/backends/lru_caching.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::{
1515

1616
use linked_hash_map::LinkedHashMap;
1717
#[cfg(with_metrics)]
18-
use prometheus::{register_int_counter_vec, IntCounterVec};
18+
use {linera_base::prometheus_util, prometheus::IntCounterVec};
1919

2020
#[cfg(with_testing)]
2121
use crate::memory::MemoryStore;
@@ -30,14 +30,14 @@ use crate::{
3030
#[cfg(with_metrics)]
3131
/// The total number of cache faults
3232
static NUM_CACHE_FAULT: LazyLock<IntCounterVec> = LazyLock::new(|| {
33-
register_int_counter_vec!("num_cache_fault", "Number of cache faults", &[])
33+
prometheus_util::register_int_counter_vec("num_cache_fault", "Number of cache faults", &[])
3434
.expect("Counter creation should not fail")
3535
});
3636

3737
#[cfg(with_metrics)]
3838
/// The total number of cache successes
3939
static NUM_CACHE_SUCCESS: LazyLock<IntCounterVec> = LazyLock::new(|| {
40-
register_int_counter_vec!("num_cache_success", "Number of cache success", &[])
40+
prometheus_util::register_int_counter_vec("num_cache_success", "Number of cache success", &[])
4141
.expect("Counter creation should not fail")
4242
});
4343

linera-views/src/metrics.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ pub fn increment_counter(counter: &LazyLock<IntCounterVec>, struct_name: &str, b
1818
/// The metric tracking the latency of the loading of views.
1919
#[doc(hidden)]
2020
pub static LOAD_VIEW_LATENCY: LazyLock<prometheus::HistogramVec> = LazyLock::new(|| {
21-
use prometheus::register_histogram_vec;
22-
register_histogram_vec!("load_view_latency", "Load view latency", &[])
23-
.expect("Load view latency should not fail")
21+
prometheus_util::register_histogram_vec(
22+
"load_view_latency",
23+
"Load view latency",
24+
&[],
25+
Some(vec![
26+
0.001, 0.003, 0.01, 0.03, 0.1, 0.2, 0.3, 0.4, 0.5, 0.75, 1.0, 2.0, 5.0,
27+
]),
28+
)
29+
.expect("Load view latency should not fail")
2430
});
2531

2632
/// The metric counting how often a view is read from storage.

0 commit comments

Comments
 (0)