From 31b96e712ff0265f3514d385809a285b8b3b901d Mon Sep 17 00:00:00 2001 From: Robin Opletal Date: Fri, 21 Jun 2024 15:25:32 +0200 Subject: [PATCH] fix(config): solve Go compilation issues --- internal/config/types.go | 1 + internal/helpers/prometheus_helper.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/config/types.go b/internal/config/types.go index 6a5a52e..b4a3ea0 100644 --- a/internal/config/types.go +++ b/internal/config/types.go @@ -7,6 +7,7 @@ import ( type Config struct { MimirRuleRequeuePeriod time.Duration AlertingBurnRates AlertingBurnRates + DefaultBaseWindow time.Duration } type AlertingBurnRates struct { diff --git a/internal/helpers/prometheus_helper.go b/internal/helpers/prometheus_helper.go index eacea9f..2b0d946 100644 --- a/internal/helpers/prometheus_helper.go +++ b/internal/helpers/prometheus_helper.go @@ -301,8 +301,8 @@ func (mrs *MonitoringRuleSet) SetupRules() ([]monitoringv1.RuleGroup, error) { } func CreatePrometheusRule(slo *openslov1.SLO, sli *openslov1.SLI) (*monitoringv1.PrometheusRule, error) { - cfg := config.NewConfig() // should we initialize the config once somewhere and pass it around? Do we care? - baseWindow := config.DefaultBaseWindow + cfg := config.NewConfig() + baseWindow := cfg.DefaultBaseWindow.String() if slo.ObjectMeta.Annotations["osko.dev/baseWindow"] != "" { baseWindow = slo.ObjectMeta.Annotations["osko.dev/baseWindow"] }