Fixes according to the code review

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
This commit is contained in:
m.nabokikh 2023-07-23 00:37:30 +02:00
parent 39d008f94f
commit 9d8463339d
2 changed files with 9 additions and 7 deletions

View File

@ -3415,6 +3415,10 @@ static_configs:
# List of Alertmanager relabel configurations.
relabel_configs:
[ - <relabel_config> ... ]
# List of alert relabel configurations.
alert_relabel_configs:
[ - <relabel_config> ... ]
```
### `<remote_write>`

View File

@ -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)
}
})
}
keep := relabel.ProcessBuilder(lb, relabelConfigs...)
if !keep {