diff --git a/alert/consume.go b/alert/consume.go index f71c4d61..53de1509 100644 --- a/alert/consume.go +++ b/alert/consume.go @@ -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() diff --git a/config/config.go b/config/config.go index 6e9b0086..7f241f25 100644 --- a/config/config.go +++ b/config/config.go @@ -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 { diff --git a/judge/handler.go b/judge/handler.go index 2eb02edb..265aee70 100644 --- a/judge/handler.go +++ b/judge/handler.go @@ -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) } diff --git a/judge/query.go b/judge/query.go index 6b760378..16979f8e 100644 --- a/judge/query.go +++ b/judge/query.go @@ -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, diff --git a/timer/res_tags.go b/timer/res_tags.go index c828de25..795797d2 100644 --- a/timer/res_tags.go +++ b/timer/res_tags.go @@ -48,24 +48,22 @@ func syncResourceTags() error { resTagsMap := make(map[string]cache.ResourceAndTags) for i := 0; i < len(resources); i++ { - tagslst := strings.Fields(resources[i].Tags) - count := len(tagslst) - if count == 0 { - continue + resAndTags := cache.ResourceAndTags{ + Resource: resources[i], } - tagsmap := make(map[string]string, count) - for i := 0; i < count; i++ { - arr := strings.Split(tagslst[i], "=") - if len(arr) != 2 { - continue + tagslst := strings.Fields(resources[i].Tags) + count := len(tagslst) + 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