From 6c87d9a1e7a8223bd947414b767023657fb11bfe Mon Sep 17 00:00:00 2001 From: Santiago Date: Thu, 11 Jan 2024 12:12:35 +0100 Subject: [PATCH] Alerting: Stop retries on 4xx status code responses (remote Alertmanager readiness check) (#80350) --- pkg/services/ngalert/remote/client/alertmanager.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/services/ngalert/remote/client/alertmanager.go b/pkg/services/ngalert/remote/client/alertmanager.go index 911fc628d17..2f93652bc3b 100644 --- a/pkg/services/ngalert/remote/client/alertmanager.go +++ b/pkg/services/ngalert/remote/client/alertmanager.go @@ -107,6 +107,10 @@ func (am *Alertmanager) IsReadyWithBackoff(ctx context.Context) (bool, error) { } if status != http.StatusOK { + if status/400 == 1 { + am.logger.Debug("Ready check failed with non-retriable status code", "attempt", attempts, "status", status) + return false, fmt.Errorf("ready check failed with non-retriable status code %d", status) + } am.logger.Debug("Ready check failed, status code is not 200", "attempt", attempts, "status", status, "err", err) continue }