-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG][OBX-UX-MNGMT] Fix IS_NOT_BETWEEN comparator for the custom threshold, Infra, Metric rules #171925
[BUG][OBX-UX-MNGMT] Fix IS_NOT_BETWEEN comparator for the custom threshold, Infra, Metric rules #171925
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,8 @@ export const createConditionScript = (threshold: number[], comparator: Comparato | |
} | ||
if (comparator === Comparator.OUTSIDE_RANGE && threshold.length === 2) { | ||
return { | ||
source: `params.value < params.threshold0 && params.value > params.threshold1 ? 1 : 0`, | ||
// OUTSIDE_RANGE/NOT BETWEEN is the opposite of BETWEEN. Use the BETWEEN condition and switch the 1 and 0 | ||
source: `params.value > params.threshold0 && params.value < params.threshold1 ? 0 : 1`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shall we change one of the API integration tests to is not between? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, @maryam-saeidi. I was thinking about adding a new test case for it. I will give it a try in the PR |
||
params: { | ||
threshold0: threshold[0], | ||
threshold1: threshold[1], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also fix it by using
||
instead of&&
, and it will give exactly the same outcomes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would it work then, with threshold0 being the start of the range?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will work as expected and as the current solution. Whoever comes to
true
first,params.value < params.threshold0
orparams.value > params.threshold1
, the rule will trigger an alert.