Last active
February 16, 2021 21:11
-
-
Save kylebrandt/3074065e35489f783fe3b0928fef06f4 to your computer and use it in GitHub Desktop.
Dashboard Alerting keep state issues
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
name: "pending -> error(keep) with for duration have passed", | |
expected: models.AlertStatePending, | |
applyFn: func(ec *EvalContext) { | |
ec.PrevAlertState = models.AlertStatePending | |
ec.Rule.ExecutionErrorState = models.ExecutionErrorKeepState | |
ec.Error = errors.New("test error") | |
ec.Rule.For = time.Minute * 5 | |
ec.Rule.LastStateChange = time.Now().Add(-time.Minute * 20) | |
}, | |
}, | |
{ | |
name: "pending -> error(keep) with for duration have not passed", | |
expected: models.AlertStatePending, | |
applyFn: func(ec *EvalContext) { | |
ec.PrevAlertState = models.AlertStatePending | |
ec.Rule.ExecutionErrorState = models.ExecutionErrorKeepState | |
ec.Error = errors.New("test error") | |
ec.Rule.For = time.Minute * 5 | |
ec.Rule.LastStateChange = time.Now().Add(-time.Minute * 2) | |
}, | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
name: "pending -> no_data(keep_last) with for duration have passed", | |
expected: models.AlertStatePending, | |
applyFn: func(ec *EvalContext) { | |
ec.PrevAlertState = models.AlertStatePending | |
ec.Rule.NoDataState = models.NoDataKeepState | |
ec.NoDataFound = true | |
ec.Rule.For = time.Minute * 5 | |
ec.Rule.LastStateChange = time.Now().Add(-time.Minute * 20) | |
}, | |
}, | |
{ | |
name: "pending -> no_data(keep_last) with for duration have not passed", | |
expected: models.AlertStatePending, | |
applyFn: func(ec *EvalContext) { | |
ec.PrevAlertState = models.AlertStatePending | |
ec.Rule.NoDataState = models.NoDataKeepState | |
ec.NoDataFound = true | |
ec.Rule.For = time.Minute * 5 | |
ec.Rule.LastStateChange = time.Now().Add(-time.Minute * 2) | |
}, | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment