mirror of
https://github.com/nezhahq/nezha.git
synced 2025-03-11 08:18:13 -04:00
fix: range data point
Some checks failed
Contributors / contributors (push) Waiting to run
Sync / sync-to-jihulab (push) Waiting to run
Run Tests / tests (macos) (push) Waiting to run
Run Tests / tests (ubuntu) (push) Waiting to run
Run Tests / tests (windows) (push) Waiting to run
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Some checks failed
Contributors / contributors (push) Waiting to run
Sync / sync-to-jihulab (push) Waiting to run
Run Tests / tests (macos) (push) Waiting to run
Run Tests / tests (ubuntu) (push) Waiting to run
Run Tests / tests (windows) (push) Waiting to run
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
This commit is contained in:
parent
831ddf1136
commit
d972d331e2
@ -79,7 +79,7 @@ func (r *AlertRule) Check(points [][]bool) (int, bool) {
|
||||
durations := make([]int, len(r.Rules))
|
||||
|
||||
for ruleIndex, rule := range r.Rules {
|
||||
fail, duration := 0, int(rule.Duration)
|
||||
duration := int(rule.Duration)
|
||||
if rule.IsTransferDurationRule() {
|
||||
// 循环区间流量报警
|
||||
if durations[ruleIndex] < 1 {
|
||||
@ -97,9 +97,10 @@ func (r *AlertRule) Check(points [][]bool) (int, bool) {
|
||||
if hasPassedRule = boundCheck(len(points), duration, hasPassedRule); hasPassedRule {
|
||||
continue
|
||||
}
|
||||
for timeTick := len(points); timeTick > len(points)-duration; timeTick-- {
|
||||
var fail int
|
||||
for _, point := range slices.Backward(points[len(points)-duration:]) {
|
||||
fail++
|
||||
if points[timeTick][ruleIndex] {
|
||||
if point[ruleIndex] {
|
||||
hasPassedRule = true
|
||||
break
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user