From b7f03d9b76445030bfb8c80b7957d1629a659033 Mon Sep 17 00:00:00 2001 From: Maxime Demolin Date: Tue, 20 Jan 2026 14:51:58 +0100 Subject: [PATCH] Reset Prometheus gauge between each ticks When changing a team, we had duplicated metrics: one with the old team name, and one with the new team name. This is because the `Load()` method in only setting / updating metrics, but its not clearing the old ones. This patch is adding a `Reset()` at the beginning to ensure clearing of stale data. Signed-off-by: Maxime Demolin --- internal/metrics/project.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/metrics/project.go b/internal/metrics/project.go index 02f9480..4113c1b 100644 --- a/internal/metrics/project.go +++ b/internal/metrics/project.go @@ -31,6 +31,7 @@ func New(registry *prometheus.Registry, extraLabels []string) (*Project, error) } func (p *Project) Load(results []aggregates.ProjectResult) { + p.checksGauge.Reset() for _, project := range results { projectLabels := project.Labels for _, result := range project.CheckResults {