From fa8213210f2676b242119a3169b90c33875118c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paolo=20Chil=C3=A0?= Date: Thu, 28 Nov 2024 10:39:29 +0100 Subject: [PATCH] Increase failure threshold for agent monitoring inputs from 2 to 5 (#6160) (cherry picked from commit 719097817f613d5826e14519016983d1dc7bc5e7) --- .../pkg/agent/application/monitoring/v1_monitor.go | 4 ++-- .../agent/application/monitoring/v1_monitor_test.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/pkg/agent/application/monitoring/v1_monitor.go b/internal/pkg/agent/application/monitoring/v1_monitor.go index 7efcd155e15..e438fbd5226 100644 --- a/internal/pkg/agent/application/monitoring/v1_monitor.go +++ b/internal/pkg/agent/application/monitoring/v1_monitor.go @@ -64,8 +64,8 @@ const ( defaultMetricsCollectionInterval = 60 * time.Second // metricset stream failure threshold before the stream is marked as DEGRADED - // to avoid marking the agent degraded for transient errors, we set the default threshold to 2 - defaultMetricsStreamFailureThreshold = uint(2) + // to avoid marking the agent degraded for transient errors, we set the default threshold to 5 + defaultMetricsStreamFailureThreshold = uint(5) ) var ( diff --git a/internal/pkg/agent/application/monitoring/v1_monitor_test.go b/internal/pkg/agent/application/monitoring/v1_monitor_test.go index 4d3449d244c..4cd3e61cf00 100644 --- a/internal/pkg/agent/application/monitoring/v1_monitor_test.go +++ b/internal/pkg/agent/application/monitoring/v1_monitor_test.go @@ -263,7 +263,7 @@ func TestMonitoringConfigMetricsFailureThreshold(t *testing.T) { agentInfo, err := info.NewAgentInfo(context.Background(), false) require.NoError(t, err, "Error creating agent info") - sampleFiveErrorsStreamThreshold := uint(5) + sampleSevenErrorsStreamThreshold := uint(7) sampleTenErrorsStreamThreshold := uint(10) tcs := []struct { @@ -307,7 +307,7 @@ func TestMonitoringConfigMetricsFailureThreshold(t *testing.T) { HTTP: &monitoringcfg.MonitoringHTTPConfig{ Enabled: false, }, - FailureThreshold: &sampleFiveErrorsStreamThreshold, + FailureThreshold: &sampleSevenErrorsStreamThreshold, }, }, policy: map[string]any{ @@ -323,7 +323,7 @@ func TestMonitoringConfigMetricsFailureThreshold(t *testing.T) { "default": map[string]any{}, }, }, - expectedThreshold: sampleFiveErrorsStreamThreshold, + expectedThreshold: sampleSevenErrorsStreamThreshold, }, { name: "policy failure threshold uint", @@ -334,7 +334,7 @@ func TestMonitoringConfigMetricsFailureThreshold(t *testing.T) { HTTP: &monitoringcfg.MonitoringHTTPConfig{ Enabled: false, }, - FailureThreshold: &sampleFiveErrorsStreamThreshold, + FailureThreshold: &sampleSevenErrorsStreamThreshold, }, }, policy: map[string]any{ @@ -362,7 +362,7 @@ func TestMonitoringConfigMetricsFailureThreshold(t *testing.T) { HTTP: &monitoringcfg.MonitoringHTTPConfig{ Enabled: false, }, - FailureThreshold: &sampleFiveErrorsStreamThreshold, + FailureThreshold: &sampleSevenErrorsStreamThreshold, }, }, policy: map[string]any{ @@ -390,7 +390,7 @@ func TestMonitoringConfigMetricsFailureThreshold(t *testing.T) { HTTP: &monitoringcfg.MonitoringHTTPConfig{ Enabled: false, }, - FailureThreshold: &sampleFiveErrorsStreamThreshold, + FailureThreshold: &sampleSevenErrorsStreamThreshold, }, }, policy: map[string]any{