From 6ca646caadcda2fbde6befdb2a2f1cac1cd3da59 Mon Sep 17 00:00:00 2001 From: Dimitar Kostadinov Date: Mon, 19 Feb 2024 16:02:45 +0200 Subject: [PATCH] Initialize proxy prometheus counters values to 0 to prevent gaps after registry restart Signed-off-by: Dimitar Kostadinov --- registry/proxy/proxymetrics.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/registry/proxy/proxymetrics.go b/registry/proxy/proxymetrics.go index e2c5d242..0b492fe1 100644 --- a/registry/proxy/proxymetrics.go +++ b/registry/proxy/proxymetrics.go @@ -62,6 +62,16 @@ func init() { })) metrics.Register(prometheus.ProxyNamespace) + initPrometheusMetrics("blob") + initPrometheusMetrics("manifest") +} + +func initPrometheusMetrics(value string) { + requests.WithValues(value).Inc(0) + hits.WithValues(value).Inc(0) + misses.WithValues(value).Inc(0) + pulledBytes.WithValues(value).Inc(0) + pushedBytes.WithValues(value).Inc(0) } // BlobPull tracks metrics about blobs pulled into the cache