From a500bb06fb69069286d85d12cdd7be7d6b42b607 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Fri, 23 Jun 2023 22:40:50 +0200 Subject: [PATCH] use preinitialize_metrics to initialize page cache metrics (#4557) This is follow-up to ``` commit 2252c5c282e8463b0f1dc1d9c7484e50706392e9 Author: Alex Chi Z Date: Wed Jun 14 17:12:34 2023 -0400 metrics: convert some metrics to pageserver-level (#4490) ``` --- pageserver/src/metrics.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pageserver/src/metrics.rs b/pageserver/src/metrics.rs index b7fdc65a00..00745143bd 100644 --- a/pageserver/src/metrics.rs +++ b/pageserver/src/metrics.rs @@ -845,11 +845,6 @@ impl TimelineMetrics { let evictions_with_low_residence_duration = evictions_with_low_residence_duration_builder.build(&tenant_id, &timeline_id); - // TODO(chi): remove this once we remove Lazy for all metrics. Otherwise this will not appear in the exporter - // and integration test will error. - MATERIALIZED_PAGE_CACHE_HIT_DIRECT.get(); - MATERIALIZED_PAGE_CACHE_HIT.get(); - TimelineMetrics { tenant_id, timeline_id, @@ -1324,4 +1319,8 @@ pub fn preinitialize_metrics() { // Same as above for this metric, but, it's a Vec-type metric for which we don't know all the labels. BACKGROUND_LOOP_PERIOD_OVERRUN_COUNT.reset(); + + // Python tests need these. + MATERIALIZED_PAGE_CACHE_HIT_DIRECT.get(); + MATERIALIZED_PAGE_CACHE_HIT.get(); }