-
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
Conversation
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
@@ -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`, |
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
or params.value > params.threshold1
, the rule will trigger an alert.
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.
@@ -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 comment
The 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 comment
The 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
@elasticmachine merge upstream |
…etric-infra-rules
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: cc @fkanout |
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.
LGTM! 👍🏻
Summary
Fixes #169524
Fix the painless script that evaluates the IS_NOT_BETWEEN for the Custom Threshold, Metric, Infra rules.