From 9d8463339d70f8d39314b11615ae4350e246dc63 Mon Sep 17 00:00:00 2001 From: "m.nabokikh" Date: Sun, 23 Jul 2023 00:37:30 +0200 Subject: [PATCH] Fixes according to the code review Signed-off-by: m.nabokikh --- docs/configuration/configuration.md | 4 ++++ notifier/notifier.go | 12 +++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index 30bb07a8c..0efded225 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -3415,6 +3415,10 @@ static_configs: # List of Alertmanager relabel configurations. relabel_configs: [ - ... ] + +# List of alert relabel configurations. +alert_relabel_configs: + [ - ... ] ``` ### `` diff --git a/notifier/notifier.go b/notifier/notifier.go index 630cbdf1e..0f93c25a3 100644 --- a/notifier/notifier.go +++ b/notifier/notifier.go @@ -383,13 +383,11 @@ func relabelAlerts(relabelConfigs []*relabel.Config, externalLabels labels.Label for _, a := range alerts { lb.Reset(a.Labels) - if externalLabels.Len() > 0 { - externalLabels.Range(func(l labels.Label) { - if a.Labels.Get(l.Name) == "" { - lb.Set(l.Name, l.Value) - } - }) - } + externalLabels.Range(func(l labels.Label) { + if a.Labels.Get(l.Name) == "" { + lb.Set(l.Name, l.Value) + } + }) keep := relabel.ProcessBuilder(lb, relabelConfigs...) if !keep {