|
@@ -220,34 +220,27 @@ func saveTimeWindow(faultLabel string, faultHappenTime string, lastTimeWindow *c
|
|
// 2-2 如果在旧故障窗口内
|
|
// 2-2 如果在旧故障窗口内
|
|
global.TimeWindowProducerQueueMutex.RLock()
|
|
global.TimeWindowProducerQueueMutex.RLock()
|
|
defer global.TimeWindowProducerQueueMutex.RUnlock()
|
|
defer global.TimeWindowProducerQueueMutex.RUnlock()
|
|
- log.GlobalLogger.Info("在旧故障窗口内,更新生产者队列最新的窗口 - 开始:", lastTimeWindow)
|
|
|
|
// 2-2-1 更新故障窗口end时间
|
|
// 2-2-1 更新故障窗口end时间
|
|
- {
|
|
|
|
- maxEnd := util.TimeCustomChange(lastTimeWindow.TimeWindowBegin, cfg.PlatformConfig.TaskMaxTime)
|
|
|
|
- expectEnd := util.TimeCustomChange(faultHappenTime, cfg.PlatformConfig.TaskAfterTime)
|
|
|
|
- if util.TimeCustom1GreaterTimeCustom2(expectEnd, maxEnd) {
|
|
|
|
- lastTimeWindow.TimeWindowEnd = maxEnd
|
|
|
|
- lastTimeWindow.Length = cfg.PlatformConfig.TaskMaxTime
|
|
|
|
- } else {
|
|
|
|
- if util.TimeCustom1GreaterTimeCustom2(expectEnd, lastTimeWindow.TimeWindowEnd) {
|
|
|
|
- lastTimeWindow.TimeWindowEnd = expectEnd
|
|
|
|
- lastTimeWindow.Length = util.CalculateDifferenceOfTimeCustom(lastTimeWindow.TimeWindowBegin, expectEnd)
|
|
|
|
- }
|
|
|
|
|
|
+ maxEnd := util.TimeCustomChange(lastTimeWindow.TimeWindowBegin, cfg.PlatformConfig.TaskMaxTime)
|
|
|
|
+ expectEnd := util.TimeCustomChange(faultHappenTime, cfg.PlatformConfig.TaskAfterTime)
|
|
|
|
+ if util.TimeCustom1GreaterTimeCustom2(expectEnd, maxEnd) {
|
|
|
|
+ lastTimeWindow.TimeWindowEnd = maxEnd
|
|
|
|
+ lastTimeWindow.Length = cfg.PlatformConfig.TaskMaxTime
|
|
|
|
+ } else {
|
|
|
|
+ if util.TimeCustom1GreaterTimeCustom2(expectEnd, lastTimeWindow.TimeWindowEnd) {
|
|
|
|
+ lastTimeWindow.TimeWindowEnd = expectEnd
|
|
|
|
+ lastTimeWindow.Length = util.CalculateDifferenceOfTimeCustom(lastTimeWindow.TimeWindowBegin, expectEnd)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 2-2-2 更新label
|
|
// 2-2-2 更新label
|
|
- {
|
|
|
|
- labels := lastTimeWindow.Labels
|
|
|
|
- lastTimeWindow.Labels = util.AppendIfNotExists(labels, faultLabel)
|
|
|
|
- }
|
|
|
|
|
|
+ labels := lastTimeWindow.Labels
|
|
|
|
+ lastTimeWindow.Labels = util.AppendIfNotExists(labels, faultLabel)
|
|
// 2-2-3 更新 topic
|
|
// 2-2-3 更新 topic
|
|
- {
|
|
|
|
- sourceMasterTopics := lastTimeWindow.MasterTopics
|
|
|
|
- lastTimeWindow.MasterTopics = util.MergeSlice(sourceMasterTopics, masterTopics)
|
|
|
|
- sourceSlaveTopics := lastTimeWindow.SlaveTopics
|
|
|
|
- lastTimeWindow.SlaveTopics = util.MergeSlice(sourceSlaveTopics, slaveTopics)
|
|
|
|
- }
|
|
|
|
- log.GlobalLogger.Info("在旧故障窗口内,更新窗口 - 结束:", *lastTimeWindow)
|
|
|
|
|
|
+ sourceMasterTopics := lastTimeWindow.MasterTopics
|
|
|
|
+ lastTimeWindow.MasterTopics = util.MergeSlice(sourceMasterTopics, masterTopics)
|
|
|
|
+ sourceSlaveTopics := lastTimeWindow.SlaveTopics
|
|
|
|
+ lastTimeWindow.SlaveTopics = util.MergeSlice(sourceSlaveTopics, slaveTopics)
|
|
|
|
+ log.GlobalLogger.Infof("在旧故障窗口内,更新生产者队列最新的窗口,【FaultTime】=%v,【Length】=%v", lastTimeWindow.FaultTime, lastTimeWindow.Length)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|