From 1922c204316bb3c127a9d6c8e8b238e11dd64975 Mon Sep 17 00:00:00 2001 From: Hristo Voyvodov Date: Tue, 19 Dec 2023 12:11:56 +0200 Subject: [PATCH] rollback return of NewRegistry to copy, not pointer --- internal/metrics/metrics.go | 2 +- internal/metrics/registry.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/metrics/metrics.go b/internal/metrics/metrics.go index eb97579..a2c1c90 100644 --- a/internal/metrics/metrics.go +++ b/internal/metrics/metrics.go @@ -80,7 +80,7 @@ func ExposeMetrics(ctx context.Context, eventChan <-chan event.SaltEvent, watchC return } - eventToMetrics(event, registry) + eventToMetrics(event, ®istry) } } } diff --git a/internal/metrics/registry.go b/internal/metrics/registry.go index 62ea25f..6ab7dd6 100644 --- a/internal/metrics/registry.go +++ b/internal/metrics/registry.go @@ -27,7 +27,7 @@ type Registry struct { minionsTotal *prometheus.GaugeVec } -func NewRegistry(config Config) *Registry { +func NewRegistry(config Config) Registry { functionResponsesTotalLabels := []string{"function", "state", "success"} if config.SaltFunctionResponsesTotal.AddMinionLabel { functionResponsesTotalLabels = append([]string{"minion"}, functionResponsesTotalLabels...) @@ -38,7 +38,7 @@ func NewRegistry(config Config) *Registry { scheduledJobReturnTotalLabels = append([]string{"minion"}, scheduledJobReturnTotalLabels...) } - return &Registry{ + return Registry{ config: config, observedMinions: 0,