mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
committed by
Carl Bergquist
parent
34f314552d
commit
e06abb30aa
@@ -117,6 +117,21 @@ func (this *Alert) ContainsUpdates(other *Alert) bool {
|
||||
return result
|
||||
}
|
||||
|
||||
func (alert *Alert) GetTagsFromSettings() []*Tag {
|
||||
tags := []*Tag{}
|
||||
if alert.Settings != nil {
|
||||
if data, ok := alert.Settings.CheckGet("alertRuleTags"); ok {
|
||||
for tagNameString, tagValue := range data.MustMap() {
|
||||
// MustMap() already guarantees the return of a `map[string]interface{}`.
|
||||
// Therefore we only need to verify that tagValue is a String.
|
||||
tagValueString := simplejson.NewFromAny(tagValue).MustString()
|
||||
tags = append(tags, &Tag{Key: tagNameString, Value: tagValueString})
|
||||
}
|
||||
}
|
||||
}
|
||||
return tags
|
||||
}
|
||||
|
||||
type AlertingClusterInfo struct {
|
||||
ServerId string
|
||||
ClusterSize int
|
||||
|
||||
Reference in New Issue
Block a user