mirror of
https://github.com/prometheus/prometheus.git
synced 2025-09-21 05:41:01 +02:00
fix(notifier): create a new alert when relabeling alters labels
Signed-off-by: machine424 <ayoubmrini424@gmail.com>
This commit is contained in:
parent
bd725fd6b8
commit
8f79470ca9
@ -84,7 +84,18 @@ func relabelAlerts(relabelConfigs []*relabel.Config, externalLabels labels.Label
|
||||
if !keep {
|
||||
continue
|
||||
}
|
||||
a.Labels = lb.Labels()
|
||||
|
||||
// If relabeling has altered the labels, create a new Alert to preserve immutability.
|
||||
if !labels.Equal(a.Labels, lb.Labels()) {
|
||||
a = &Alert{
|
||||
Labels: lb.Labels(),
|
||||
Annotations: a.Annotations,
|
||||
StartsAt: a.StartsAt,
|
||||
EndsAt: a.EndsAt,
|
||||
GeneratorURL: a.GeneratorURL,
|
||||
}
|
||||
}
|
||||
|
||||
relabeledAlerts = append(relabeledAlerts, a)
|
||||
}
|
||||
return relabeledAlerts
|
||||
|
Loading…
x
Reference in New Issue
Block a user