fix: process event mute
This commit is contained in:
parent
258e9738f7
commit
477cac6ca9
|
@ -22,7 +22,7 @@ import (
|
|||
)
|
||||
|
||||
func popEvent() {
|
||||
sema := semaphore.NewSemaphore(config.Config.Alert.NotifyConcurrency)
|
||||
sema := semaphore.NewSemaphore(config.Config.Alert.NotifyScriptConcurrency)
|
||||
duration := time.Duration(100) * time.Millisecond
|
||||
for {
|
||||
events := judge.EventQueue.PopBackBy(200)
|
||||
|
@ -60,7 +60,7 @@ func consume(events []interface{}, sema *semaphore.Semaphore) {
|
|||
event.ResClasspaths = strings.Join(classpaths, " ")
|
||||
enrichTag(event, alertRule)
|
||||
|
||||
if isEventMute(event) {
|
||||
if isEventMute(event) && event.IsAlert() {
|
||||
// 被屏蔽的事件
|
||||
event.MarkMuted()
|
||||
|
||||
|
|
|
@ -39,9 +39,9 @@ type tplSection struct {
|
|||
}
|
||||
|
||||
type alertSection struct {
|
||||
NotifyScriptPath string `yaml:"notifyScriptPath"`
|
||||
NotifyConcurrency int `yaml:"notifyConcurrency"`
|
||||
MutedAlertPersist bool `yaml:"mutedAlertPersist"`
|
||||
NotifyScriptPath string `yaml:"notifyScriptPath"`
|
||||
NotifyScriptConcurrency int `yaml:"notifyScriptConcurrency"`
|
||||
MutedAlertPersist bool `yaml:"mutedAlertPersist"`
|
||||
}
|
||||
|
||||
type transSection struct {
|
||||
|
|
|
@ -325,7 +325,7 @@ func ToJudge(linkedList *SafeLinkedList, stra *models.AlertRule, val *vos.Metric
|
|||
ReadableExpression: eventInfo,
|
||||
TagMap: val.TagsMap,
|
||||
}
|
||||
logger.Debugf("[ToJudge.event.create][type=push][stra:%+v][val:%+v][event:%+v]", stra, val, event)
|
||||
logger.Debugf("[ToJudge.event.create][statusArr:%v][type=push][stra:%+v][val:%+v][event:%+v]", statusArr, stra, val, event)
|
||||
sendEventIfNeed(statusArr, event, stra)
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,10 @@ func Query(reqs *vos.DataQueryParam) []*vos.HPoint {
|
|||
|
||||
//裁剪掉多余的点
|
||||
for _, i := range fD.Values {
|
||||
if i.Timestamp/1000000000 == 1000 {
|
||||
i.Timestamp = i.Timestamp / 1000
|
||||
}
|
||||
|
||||
oneV := &vos.HPoint{
|
||||
Timestamp: i.Timestamp,
|
||||
Value: i.Value,
|
||||
|
|
|
@ -48,24 +48,22 @@ func syncResourceTags() error {
|
|||
|
||||
resTagsMap := make(map[string]cache.ResourceAndTags)
|
||||
for i := 0; i < len(resources); i++ {
|
||||
resAndTags := cache.ResourceAndTags{
|
||||
Resource: resources[i],
|
||||
}
|
||||
|
||||
tagslst := strings.Fields(resources[i].Tags)
|
||||
count := len(tagslst)
|
||||
if count == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
tagsmap := make(map[string]string, count)
|
||||
for i := 0; i < count; i++ {
|
||||
arr := strings.Split(tagslst[i], "=")
|
||||
if len(arr) != 2 {
|
||||
continue
|
||||
if count != 0 {
|
||||
tagsmap := make(map[string]string, count)
|
||||
for i := 0; i < count; i++ {
|
||||
arr := strings.Split(tagslst[i], "=")
|
||||
if len(arr) != 2 {
|
||||
continue
|
||||
}
|
||||
tagsmap[arr[0]] = arr[1]
|
||||
}
|
||||
tagsmap[arr[0]] = arr[1]
|
||||
}
|
||||
|
||||
resAndTags := cache.ResourceAndTags{
|
||||
Tags: tagsmap,
|
||||
Resource: resources[i],
|
||||
resAndTags.Tags = tagsmap
|
||||
}
|
||||
|
||||
resTagsMap[resources[i].Ident] = resAndTags
|
||||
|
|
Loading…
Reference in New Issue