Skip to content
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

Merged
merged 13 commits into from
Apr 26, 2019

Conversation

bmcconaghy
Copy link
Contributor

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.

@bmcconaghy bmcconaghy added Feature:Watcher Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more labels Apr 25, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@alisonelizabeth
Copy link
Contributor

@bmcconaghy do you think you could share some of the type of watches you used to test?

@bmcconaghy
Copy link
Contributor Author

@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.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a 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',
Copy link
Contributor

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

Copy link
Contributor Author

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';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Contributor Author

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';
Copy link
Contributor

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

Copy link
Contributor Author

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])) {
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup fixed

@alisonelizabeth
Copy link
Contributor

I also noticed the alignment is a little off for the AND in the between comparator. We can fix in a separate PR, just mentioning it here while I'm thinking about it.

Screen Shot 2019-04-26 at 8 42 01 AM

@elasticmachine
Copy link
Contributor

💔 Build Failed

@bmcconaghy
Copy link
Contributor Author

@alisonelizabeth thx for the review. Noticed the alignment issue too and fixed it:
image

@alisonelizabeth
Copy link
Contributor

@bmcconaghy thanks for making the changes! LGTM.

@bmcconaghy
Copy link
Contributor Author

retest

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@bmcconaghy bmcconaghy merged commit 2f79b06 into elastic:watcher-port Apr 26, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@bmcconaghy
Copy link
Contributor Author

retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Watcher Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants