From 9a3020d2ce038d61ae2b180a6ab698cf2232cb87 Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Thu, 13 Mar 2025 20:23:53 +0000 Subject: [PATCH] chore(proxy): pre-initialise metricvecs (#11226) ## Problem We noticed that error metrics didn't show for some services with light load. This is not great and can cause problems for dashboards/alerts ## Summary of changes Pre-initialise some metricvecs. --- proxy/src/metrics.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/proxy/src/metrics.rs b/proxy/src/metrics.rs index 29834760c0..e5fc0b724b 100644 --- a/proxy/src/metrics.rs +++ b/proxy/src/metrics.rs @@ -30,7 +30,16 @@ pub struct Metrics { static SELF: OnceLock = OnceLock::new(); impl Metrics { pub fn install(thread_pool: Arc) { - SELF.set(Metrics::new(thread_pool)) + let mut metrics = Metrics::new(thread_pool); + + metrics.proxy.errors_total.init_all_dense(); + metrics.proxy.redis_errors_total.init_all_dense(); + metrics.proxy.redis_events_count.init_all_dense(); + metrics.proxy.retries_metric.init_all_dense(); + metrics.proxy.invalid_endpoints_total.init_all_dense(); + metrics.proxy.connection_failures_total.init_all_dense(); + + SELF.set(metrics) .ok() .expect("proxy metrics must not be installed more than once"); }