-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
adding support for >=, <=, and between for threshold alerts #35614
Conversation
Pinging @elastic/es-ui |
💔 Build Failed |
💔 Build Failed |
@bmcconaghy do you think you could share some of the type of watches you used to test? |
@alisonelizabeth I created both a greater than and less than threshold alert, then applied the new code and made sure I could edit those watches. |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
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.
@bmcconaghy LGTM. I left a comment about a possible i18n
issue and then a nit about using constants.
}, | ||
[COMPARATORS.BETWEEN]: { | ||
text: i18n.translate( | ||
'xpack.watcher.thresholdWatchExpression.comparators.isBelowOrEqualsLabel', |
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.
dupe key - probably should be isInBetweenLabel
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.
yup fixed
@@ -5,7 +5,7 @@ | |||
*/ | |||
|
|||
import { singleLineScript } from '../lib/single_line_script'; | |||
|
|||
const BETWEEN = '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.
same here
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.
yup fixed
@@ -6,24 +6,47 @@ | |||
|
|||
import { singleLineScript } from '../lib/single_line_script'; | |||
|
|||
const BETWEEN = '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.
i think you can probably import this from the comparators.ts
constants file
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.
yup fixed
)); | ||
} | ||
}); | ||
if (this.thresholdComparator === 'between' && this.threshold[0] && this.threshold[1] && !(this.threshold[1] > this.threshold[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.
can you use the constant for between
here, instead of the hard-coded string?
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.
yup fixed
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.
yup fixed
💔 Build Failed |
@alisonelizabeth thx for the review. Noticed the alignment issue too and fixed it: |
@bmcconaghy thanks for making the changes! LGTM. |
retest |
💚 Build Succeeded |
💔 Build Failed |
retest |
This adds support for >=, <= and between as watch conditions for threshold alerts. I have tested this with watches created by the older code and backwards compatibility appears to be maintained.