mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alertmanager notifier: add "metric" labels if no tags
Signed-off-by: Thibault Chataigner <t.chataigner@criteo.com>
This commit is contained in:
parent
3a7939c930
commit
a8264fe316
@ -72,8 +72,12 @@ func (this *AlertmanagerNotifier) Notify(evalContext *alerting.EvalContext) erro
|
||||
}
|
||||
|
||||
tags := make(map[string]string)
|
||||
for k, v := range match.Tags {
|
||||
tags[k] = v
|
||||
if len(match.Tags) == 0 {
|
||||
tags["metric"] = match.Metric
|
||||
} else {
|
||||
for k, v := range match.Tags {
|
||||
tags[k] = v
|
||||
}
|
||||
}
|
||||
tags["alertname"] = evalContext.Rule.Name
|
||||
alertJSON.Set("labels", tags)
|
||||
|
Loading…
Reference in New Issue
Block a user