-
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
Add filter field to index threshold rule type #142255
Add filter field to index threshold rule type #142255
Conversation
@@ -208,7 +209,6 @@ export const EsQueryExpression: React.FC< | |||
languageId="xjson" | |||
width="100%" | |||
height="200px" | |||
data-test-subj="queryJsonEditor" |
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.
CodeEditor UI Component doesn't pass the data-test-subj attribute to the final rendered html, so i moved it to the parent row element
@@ -55,9 +55,6 @@ export default function ruleTests({ getService }: FtrProviderContext) { | |||
const endDateMillis = Date.now() + (RULE_INTERVALS_TO_WRITE - 1) * RULE_INTERVAL_MILLIS; | |||
endDate = new Date(endDateMillis).toISOString(); | |||
|
|||
// write documents from now to the future end date in 3 groups | |||
await createEsDocumentsInGroups(3); |
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.
This function creates documents with a timespan field that has values between now and the future.
But the rule looks for last "x" seconds, or in other words: between past and now.
it works, since we use patterns to test the messages. but for the new filterKuery filed i needed an exact number, so i moved this function from beforeEach to each test case. And used a fixed date for the new test case.
Pinging @elastic/response-ops (Team:ResponseOps) |
# Conflicts: # x-pack/plugins/triggers_actions_ui/server/data/lib/time_series_query.test.ts # x-pack/plugins/triggers_actions_ui/server/data/lib/time_series_query.ts
@@ -294,20 +303,21 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { | |||
await discardNewRuleCreation(); | |||
}); | |||
|
|||
it('should show error when es_query is invalid', async () => { | |||
// Failing: See https://github.com/elastic/kibana/issues/126873 | |||
it.skip('should show error when es_query is invalid', async () => { |
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.
this is the flaky test case, therefore moved skip
from describe block to here.
@@ -110,7 +110,7 @@ pageLoadAssetSize: | |||
share: 71239 | |||
snapshotRestore: 79032 | |||
spaces: 57868 | |||
stackAlerts: 29684 | |||
stackAlerts: 58316 |
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.
Created a follow-up issue to reduce bundle size: #142902
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.
Looks great! Verified that adding a filter works as expected. Left one comment about adding a debounce to the filter validation.
@@ -133,6 +142,13 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent< | |||
setEsFields(currentEsFields); | |||
}; | |||
|
|||
const handleFilterChange = useCallback( |
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.
is there any way to add a debounce here so not every keystroke is validated?
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.
Debouncing here just prevents the value to be set.
Current validation is triggered on every field change of a rule. We need to change the whole validation implementation on framework level in order to tackle validations for each field separately.
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!
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
Resolves: #66046
Adds a new filter field to index-threshold rule type.
To validate:
Create an index-threshold rule with and without filter and observe the number of documents in the visualisation.