Skip to content

Commit 313e10d

Browse files
[8.x] [Synthetics] Enable KQL filter for TLS rules (elastic#216973) (elastic#218101)
# Backport This will backport the following commits from `main` to `8.x`: - [[Synthetics] Enable KQL filter for TLS rules (elastic#216973)](elastic#216973) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Francesco Fagnani","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-04-14T12:24:31Z","message":"[Synthetics] Enable KQL filter for TLS rules (elastic#216973)\n\nThis PR follows elastic#215110 by enabling the KQL filter for TLS alerting\nrules and closes elastic#214346.","sha":"89e385ec96591e4384bf70e268bbdc16fffe79b5","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:feature","Team:obs-ux-management","backport:version","v9.1.0","v8.19.0"],"title":"[Synthetics] Enable KQL filter for TLS rules","number":216973,"url":"https://github.com/elastic/kibana/pull/216973","mergeCommit":{"message":"[Synthetics] Enable KQL filter for TLS rules (elastic#216973)\n\nThis PR follows elastic#215110 by enabling the KQL filter for TLS alerting\nrules and closes elastic#214346.","sha":"89e385ec96591e4384bf70e268bbdc16fffe79b5"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/216973","number":216973,"mergeCommit":{"message":"[Synthetics] Enable KQL filter for TLS rules (elastic#216973)\n\nThis PR follows elastic#215110 by enabling the KQL filter for TLS alerting\nrules and closes elastic#214346.","sha":"89e385ec96591e4384bf70e268bbdc16fffe79b5"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Francesco Fagnani <[email protected]>
1 parent 1e2c9f0 commit 313e10d

File tree

2 files changed

+22
-30
lines changed

2 files changed

+22
-30
lines changed

x-pack/solutions/observability/plugins/synthetics/e2e/synthetics/journeys/alert_rules/custom_tls_alert.journey.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,19 @@ journey(`CustomTLSAlert`, async ({ page, params }) => {
5555

5656
step('Should open the create TLS rule flyout', async () => {
5757
await page.getByTestId('syntheticsRefreshButtonButton').click();
58+
await expect(page.getByTestId('syntheticsAlertsRulesButton')).toBeEnabled();
5859
await page.getByTestId('syntheticsAlertsRulesButton').click();
5960
await page.getByTestId('manageTlsRuleName').click();
6061
await page.getByTestId('createNewTLSRule').click();
6162

6263
await expect(page.getByTestId('addRuleFlyoutTitle')).toBeVisible();
6364
});
6465

65-
// This is needed for the intermediate release process -> https://docs.google.com/document/d/1mU5jlIfCKyXdDPtEzAz1xTpFXFCWxqdO5ldYRVO_hgM/edit?tab=t.0#heading=h.2b1v1tr0ep8m
66-
// After the next serverless release the commit containing these changes can be reverted
67-
step.skip('Should filter monitors using the KQL filter bar', async () => {
66+
step('Should filter monitors using the KQL filter bar', async () => {
6867
// Using the KQL filter to search for a monitor type of "tcp", 0 existing monitors should be found because the type of the test monitor is 'http'
6968
await page.fill('[data-test-subj="queryInput"]', `monitor.type: "tcp" `);
7069
await page.keyboard.press('Enter');
71-
await expect(page.getByTestId('syntheticsRuleVizMonitorQueryIDsButton')).toHaveText(
70+
await expect(page.getByTestId('syntheticsStatusRuleVizMonitorQueryIDsButton')).toHaveText(
7271
'0 existing monitors'
7372
);
7473

@@ -77,14 +76,12 @@ journey(`CustomTLSAlert`, async ({ page, params }) => {
7776
await page.keyboard.press('Enter');
7877
});
7978

80-
// This is needed for the intermediate release process -> https://docs.google.com/document/d/1mU5jlIfCKyXdDPtEzAz1xTpFXFCWxqdO5ldYRVO_hgM/edit?tab=t.0#heading=h.2b1v1tr0ep8m
81-
// After the next serverless release the commit containing these changes can be reverted
82-
step.skip('Should filter monitors by type', async () => {
79+
step('Should filter monitors by type', async () => {
8380
await page.getByRole('button', { name: 'Type All' }).click();
8481
await page.getByTestId('comboBoxInput').click();
8582
await page.getByRole('option', { name: 'http' }).click();
8683
await page.getByTestId('ruleDefinition').getByRole('button', { name: 'Type http' }).click();
87-
await expect(page.getByTestId('syntheticsRuleVizMonitorQueryIDsButton')).toHaveText(
84+
await expect(page.getByTestId('syntheticsStatusRuleVizMonitorQueryIDsButton')).toHaveText(
8885
'1 existing monitor'
8986
);
9087
});
@@ -119,7 +116,9 @@ journey(`CustomTLSAlert`, async ({ page, params }) => {
119116

120117
await retry.tryForTime(5 * 1000, async () => {
121118
await page.getByTestId('querySubmitButton').click();
122-
await expect(page.getByText(tlsRuleName)).toBeVisible();
119+
if (!(await page.getByText(tlsRuleName).isVisible())) {
120+
throw new Error('Alert not found');
121+
}
123122
});
124123
});
125124
});

x-pack/solutions/observability/plugins/synthetics/public/apps/synthetics/components/alerts/tls_rule_ui.tsx

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ const tlsMonitorTypes = [MonitorTypeEnum.HTTP, MonitorTypeEnum.TCP];
2727
export const TLSRuleComponent: React.FC<{
2828
ruleParams: TLSRuleParamsProps['ruleParams'];
2929
setRuleParams: TLSRuleParamsProps['setRuleParams'];
30-
// This is needed for the intermediate release process -> https://docs.google.com/document/d/1mU5jlIfCKyXdDPtEzAz1xTpFXFCWxqdO5ldYRVO_hgM/edit?tab=t.0#heading=h.2b1v1tr0ep8m
31-
// After the next serverless release the commit containing these changes can be reverted
32-
showMonitorFilters?: boolean;
33-
}> = ({ ruleParams, setRuleParams, showMonitorFilters = false }) => {
30+
}> = ({ ruleParams, setRuleParams }) => {
3431
const dispatch = useDispatch();
3532

3633
const { settings } = useSelector(selectDynamicSettings);
@@ -59,23 +56,19 @@ export const TLSRuleComponent: React.FC<{
5956

6057
return (
6158
<>
62-
{showMonitorFilters ? (
63-
<>
64-
<AlertSearchBar
65-
kqlQuery={ruleParams.kqlQuery ?? ''}
66-
onChange={onFiltersChange}
67-
filtersForSuggestions={filtersForSuggestions}
68-
/>
69-
<EuiSpacer size="m" />
70-
<FieldFilters
71-
ruleParams={ruleParams}
72-
setRuleParams={setRuleParams}
73-
filters={{ monitorTypes: tlsMonitorTypes }}
74-
/>
75-
<TLSRuleViz ruleParams={ruleParams} />
76-
<EuiSpacer size="m" />
77-
</>
78-
) : null}
59+
<AlertSearchBar
60+
kqlQuery={ruleParams.kqlQuery ?? ''}
61+
onChange={onFiltersChange}
62+
filtersForSuggestions={filtersForSuggestions}
63+
/>
64+
<EuiSpacer size="m" />
65+
<FieldFilters
66+
ruleParams={ruleParams}
67+
setRuleParams={setRuleParams}
68+
filters={{ monitorTypes: tlsMonitorTypes }}
69+
/>
70+
<TLSRuleViz ruleParams={ruleParams} />
71+
<EuiSpacer size="m" />
7972
<AlertTlsCondition
8073
ageThreshold={
8174
ruleParams.certAgeThreshold ??

0 commit comments

Comments
 (0)