-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[alerts] adds support for index threshold index param string type #88540
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
[alerts] adds support for index threshold index param string type #88540
Conversation
resolves elastic#68575 The index threshold alert defines an `index` parameter which is typed as `string | string[]`. However the UI for this alert has been typing it as only `string[]`. This PR changes the UI to work with an incoming string value for this parameter. If the parameter is edited in the UI, it will always be set as an array, even if there is only one element.
|
@elasticmachine merge upstream |
|
Pinging @elastic/kibana-alerting-services (Team:Alerting Services) |
| test('if aggField property is invalid should return proper error message', () => { | ||
| const initialParams: IndexThresholdAlertParams = { | ||
| index: ['test'], | ||
| index: 'test', |
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.
Changing this test so that we have a jest test that will test a string index param (instead of the usual string[] type). It would be good to add a function test, I think, would need to create an alert using the API (passing a string typed index field), and then edit the alert and make sure the single index appears as expected in the UI. Do we have similar tests like this? Thoughts on where to add such a test?
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.
Could you use the esArchiver to load an archived alert with a string index param and then try to edit it in your functional test?
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 we should be able to create one via the API - I suspect that will be easier to figuring out esArchiver :-)
Let me see if I can add a quick one ...
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 found one - I ended up changing the test in x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts, below, from using an array of indices to a single index 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.
LGTM
It would be worth adding an e2e test for it, but not a blocker, as I know we'er trying to be more economical with UI tests :/
| groupBy: 'all', | ||
| threshold: [1000, 5000], | ||
| index: ['.kibana_1'], | ||
| index: '.kibana_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.
There is already an example of testing the array version of the index param in the alert_create_flyout tests, so it seemed like changing this other usage of the index threshold alert to use the string version would be appropriate.
ymao1
left a comment
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!
|
@elasticmachine merge upstream |
Looks like a flaky test failure in the last buildso merging master again ... |
|
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
…astic#88540) resolves elastic#68575 The index threshold alert defines an `index` parameter which is typed as `string | string[]`. However the UI for this alert has been typing it as only `string[]`. This PR changes the UI to work with an incoming string value for this parameter. If the parameter is edited in the UI, it will always be set as an array, even if there is only one element.
…8540) (#89236) resolves #68575 The index threshold alert defines an `index` parameter which is typed as `string | string[]`. However the UI for this alert has been typing it as only `string[]`. This PR changes the UI to work with an incoming string value for this parameter. If the parameter is edited in the UI, it will always be set as an array, even if there is only one element.
resolves #68575
Summary
The index threshold alert defines an
indexparameter which is typed asstring | string[]. However the UI for this alert has been typing it as onlystring[].This PR changes the UI to work with an incoming string value for this parameter. If the parameter is edited in the UI, it will always be set as an array, even if there is only one element.
Checklist
Delete any items that are not applicable to this PR.