From 08378a4b25c7447238184863670d94f9251f1b09 Mon Sep 17 00:00:00 2001 From: Michal Pristas Date: Wed, 11 Oct 2023 15:36:09 +0200 Subject: [PATCH] start stop server decision based only on metrics.enabled --- internal/pkg/agent/application/monitoring/reload/reload.go | 2 +- .../pkg/agent/application/monitoring/reload/reload_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/pkg/agent/application/monitoring/reload/reload.go b/internal/pkg/agent/application/monitoring/reload/reload.go index b39d46474f9..685a5fd6fa5 100644 --- a/internal/pkg/agent/application/monitoring/reload/reload.go +++ b/internal/pkg/agent/application/monitoring/reload/reload.go @@ -103,7 +103,7 @@ func (sr *ServerReloader) Reload(rawConfig *aConfig.Config) error { sr.config = newConfig.Settings.MonitoringConfig - shouldRunMetrics := sr.config.Enabled && sr.config.MonitorMetrics + shouldRunMetrics := sr.config.Enabled if shouldRunMetrics && !sr.isServerRunning { sr.start() diff --git a/internal/pkg/agent/application/monitoring/reload/reload_test.go b/internal/pkg/agent/application/monitoring/reload/reload_test.go index b686c5346a8..ee666029f7c 100644 --- a/internal/pkg/agent/application/monitoring/reload/reload_test.go +++ b/internal/pkg/agent/application/monitoring/reload/reload_test.go @@ -59,18 +59,18 @@ agent.monitoring.enabled: false false, false, true, }, { - "stop when running, monitoring.metrics disabled", + "do not stop when running, monitoring.metrics disabled", true, true, true, ` agent.monitoring.metrics: false `, - false, false, true, + true, false, false, }, { "stop stopped server", false, false, false, ` -agent.monitoring.metrics: false +agent.monitoring.enabled: false `, false, false, false, },