mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 04:30:05 +00:00
fix: range data point
This commit is contained in:
@@ -79,7 +79,7 @@ func (r *AlertRule) Check(points [][]bool) (int, bool) {
|
|||||||
durations := make([]int, len(r.Rules))
|
durations := make([]int, len(r.Rules))
|
||||||
|
|
||||||
for ruleIndex, rule := range r.Rules {
|
for ruleIndex, rule := range r.Rules {
|
||||||
fail, duration := 0, int(rule.Duration)
|
duration := int(rule.Duration)
|
||||||
if rule.IsTransferDurationRule() {
|
if rule.IsTransferDurationRule() {
|
||||||
// 循环区间流量报警
|
// 循环区间流量报警
|
||||||
if durations[ruleIndex] < 1 {
|
if durations[ruleIndex] < 1 {
|
||||||
@@ -97,9 +97,10 @@ func (r *AlertRule) Check(points [][]bool) (int, bool) {
|
|||||||
if hasPassedRule = boundCheck(len(points), duration, hasPassedRule); hasPassedRule {
|
if hasPassedRule = boundCheck(len(points), duration, hasPassedRule); hasPassedRule {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for timeTick := len(points); timeTick > len(points)-duration; timeTick-- {
|
var fail int
|
||||||
|
for _, point := range slices.Backward(points[len(points)-duration:]) {
|
||||||
fail++
|
fail++
|
||||||
if points[timeTick][ruleIndex] {
|
if point[ruleIndex] {
|
||||||
hasPassedRule = true
|
hasPassedRule = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user