From 24d01226d3af13aec3c7238e52804424e6c67652 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Mon, 23 Sep 2024 15:30:00 +0200 Subject: [PATCH] initialize fields with 0 Signed-off-by: Christian Richter --- services/proxy/pkg/metrics/metrics.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/proxy/pkg/metrics/metrics.go b/services/proxy/pkg/metrics/metrics.go index ef82031364..f366b3ddb0 100644 --- a/services/proxy/pkg/metrics/metrics.go +++ b/services/proxy/pkg/metrics/metrics.go @@ -49,6 +49,10 @@ func New() *Metrics { }, []string{"version"}), } + // Initialize the metrics with 0 + m.Requests.WithLabelValues("GET").Add(0) + m.Errors.WithLabelValues("GET").Add(0) + _ = prometheus.Register(m.Requests) _ = prometheus.Register(m.Errors) _ = prometheus.Register(m.Duration)