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

[RAM] Adds revision to alerts schema #151388

Merged
merged 103 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from 99 commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
542bf21
Initial plumbing of revision through alerting and security
spong Dec 12, 2022
57c17dc
Adding revision to FTRs
spong Dec 13, 2022
04033c8
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Dec 13, 2022
6d3aa3d
Fixing typechecks and more FTRs
spong Dec 13, 2022
9b28134
More typecheck fixes throughout triggers and actions ui
spong Dec 13, 2022
ef64bb1
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Dec 13, 2022
96f386b
More typecheck fixes throughout security
spong Dec 13, 2022
31b143a
Additional typecheck and FTR fixes
spong Dec 13, 2022
bdd5285
Jest fixes and detections FTR fixes
spong Dec 14, 2022
f70b505
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Dec 14, 2022
9371731
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Dec 14, 2022
396ccc1
Fixes additional detections FTRs
spong Dec 14, 2022
82feace
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Dec 15, 2022
3087e63
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Dec 16, 2022
d71e752
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Jan 4, 2023
3120bae
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Jan 23, 2023
b33d3e4
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Jan 25, 2023
6d63ae4
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Jan 25, 2023
7f5d57f
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Jan 26, 2023
1f5ce9f
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Jan 27, 2023
98b57a3
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Jan 30, 2023
daf5099
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 7, 2023
98098b5
Reuse incrementVersion in update()
spong Feb 7, 2023
e6fef49
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 7, 2023
40fa9b0
Adds migration and bulk edit support
spong Feb 7, 2023
e122adb
Adds incrementRevision logic and fixing tests
spong Feb 8, 2023
673d1c5
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 8, 2023
e4279f4
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 8, 2023
4a80747
Resolving remaining test failures
spong Feb 8, 2023
bd87b0d
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 8, 2023
f0f5c32
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 9, 2023
60abd10
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 9, 2023
827ecb3
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 10, 2023
e8f40c6
Update alert SO hash
spong Feb 10, 2023
937b2ed
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 10, 2023
e1ff58a
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 13, 2023
61dc2c0
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 13, 2023
8270e78
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 13, 2023
f7dbf41
Merge branch 'main' into adds-revision-field-to-rules
spong Feb 14, 2023
d162cd8
Remove specific version check from increment logic
spong Feb 14, 2023
ac244db
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 14, 2023
a71a309
Adds migration tests, updates bulk edit snooze tests, update_api_key …
spong Feb 15, 2023
4f971d6
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 15, 2023
2a567c1
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 15, 2023
a1a21e6
Fixes updateAPIKey tests and reset SO registered type hash
spong Feb 15, 2023
88a18f8
Removes revision update on snooze/mute/apiKeyUpdate and updates bulkE…
spong Feb 15, 2023
cc1926b
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 15, 2023
9b7e948
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 16, 2023
440d424
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 16, 2023
cbd1bed
Comments from review and expanding tests
spong Feb 22, 2023
4a39c4d
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 22, 2023
65ce48b
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 22, 2023
2b3ea72
Updates SO hash since last update from merge from main
spong Feb 22, 2023
1784b14
Updating new uuid tests to include revision
spong Feb 22, 2023
c8697d2
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 22, 2023
1a7da2f
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 22, 2023
5619b02
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 23, 2023
ef66c8d
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 23, 2023
62ca943
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 25, 2023
f949386
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 25, 2023
f3b5c4e
Adds shouldIncrementRevision bypass, fixes imports, and clarifies map…
spong Feb 27, 2023
152d53c
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 27, 2023
53a5941
Updating alert SO hash and fixing basic import test
spong Feb 27, 2023
9bd4ffd
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 27, 2023
e6f5a7b
Removing remaining todo's
spong Feb 28, 2023
73ccb27
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Feb 28, 2023
320c706
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Mar 1, 2023
24eae01
Addressing PR comments
spong Mar 1, 2023
d894736
Fixes multi increment when adding bulk actions
spong Mar 2, 2023
640526e
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Mar 2, 2023
78834e3
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Mar 7, 2023
8ce5da6
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Mar 8, 2023
41d32b3
Updating SO hash
spong Mar 8, 2023
adf18cc
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Mar 8, 2023
eef57f6
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Mar 9, 2023
2028524
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Mar 9, 2023
7896ea9
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Mar 10, 2023
646c2c2
Merge branch 'main' of github.com:elastic/kibana into adds-revision-f…
spong Mar 10, 2023
a575eb8
Skips synthetics MonitorSummaryTab flakey test
spong Mar 10, 2023
d2366cf
Updates new export tests to exclude revision
spong Mar 10, 2023
3dd9293
Adds revision to alerts schema
spong Feb 15, 2023
8d686ed
Merge branch 'main' of github.com:elastic/kibana into adds-revision-t…
spong Mar 10, 2023
df0a151
Merge branch 'main' of github.com:elastic/kibana into adds-revision-t…
spong Mar 21, 2023
8468560
Merge branch 'main' of github.com:elastic/kibana into adds-revision-t…
spong Mar 22, 2023
9f7ea49
Updating lifecycle rule mocks
spong Mar 22, 2023
166ff6b
Merge branch 'main' of github.com:elastic/kibana into adds-revision-t…
spong Mar 23, 2023
90b87a2
Merge branch 'main' of github.com:elastic/kibana into adds-revision-t…
spong Mar 23, 2023
1e0305e
Adding revision to task_manager changes from main
spong Mar 23, 2023
42f1820
Executor helper type fix
spong Mar 23, 2023
fe2d00e
Metric threshold typefix
spong Mar 23, 2023
f91e7f0
Remaining test typefixes
spong Mar 23, 2023
dade67b
Adds actual mapping to field map and updates corresponding tests
spong Mar 23, 2023
0959ede
Additional rule registry and o11y type and test fixes
spong Mar 23, 2023
10c5797
Swapping type to long to match other AAD number fields
spong Mar 24, 2023
386f124
Merge branch 'main' of github.com:elastic/kibana into adds-revision-t…
spong Mar 24, 2023
2b20c6c
Merge branch 'main' of github.com:elastic/kibana into adds-revision-t…
spong Mar 27, 2023
97e66d3
Merge branch 'main' of github.com:elastic/kibana into adds-revision-t…
spong Mar 27, 2023
1fc9861
Merge branch 'main' of github.com:elastic/kibana into adds-revision-t…
spong Mar 27, 2023
52013c4
Merge branch 'main' of github.com:elastic/kibana into adds-revision-t…
spong Mar 28, 2023
b7c544f
Merge branch 'main' of github.com:elastic/kibana into adds-revision-t…
spong Mar 28, 2023
20ce86c
Merge branch 'main' into adds-revision-to-alerts-schema
spong Mar 28, 2023
510b108
Merge branch 'main' into adds-revision-to-alerts-schema
spong Mar 29, 2023
095e1e8
Merge branch 'main' into adds-revision-to-alerts-schema
spong Mar 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
ALERT_RULE_NAME,
ALERT_RULE_PARAMETERS,
ALERT_RULE_PRODUCER,
ALERT_RULE_REVISION,
ALERT_RULE_TAGS,
ALERT_RULE_TYPE_ID,
ALERT_RULE_UUID,
Expand Down Expand Up @@ -112,6 +113,11 @@ export const alertFieldMap = {
array: false,
required: true,
},
[ALERT_RULE_REVISION]: {
type: 'long',
array: false,
required: true,
},
[ALERT_RULE_TAGS]: {
type: 'keyword',
array: true,
Expand Down
5 changes: 5 additions & 0 deletions packages/kbn-rule-data-utils/src/default_alerts_as_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ const ALERT_RULE_PARAMETERS = `${ALERT_RULE_NAMESPACE}.parameters` as const;
// kibana.alert.rule.producer - rule type producer for rule that generated this alert
const ALERT_RULE_PRODUCER = `${ALERT_RULE_NAMESPACE}.producer` as const;

// kibana.alert.rule.revision - current revision of the rule that generated this alert
const ALERT_RULE_REVISION = `${ALERT_RULE_NAMESPACE}.revision` as const;

// kibana.alert.rule.tags - rule tags for rule that generated this alert
const ALERT_RULE_TAGS = `${ALERT_RULE_NAMESPACE}.tags` as const;

Expand Down Expand Up @@ -113,6 +116,7 @@ const fields = {
ALERT_RULE_NAME,
ALERT_RULE_PARAMETERS,
ALERT_RULE_PRODUCER,
ALERT_RULE_REVISION,
ALERT_RULE_TAGS,
ALERT_RULE_TYPE_ID,
ALERT_RULE_UUID,
Expand Down Expand Up @@ -148,6 +152,7 @@ export {
ALERT_RULE_NAME,
ALERT_RULE_PARAMETERS,
ALERT_RULE_PRODUCER,
ALERT_RULE_REVISION,
ALERT_RULE_TAGS,
ALERT_RULE_TYPE_ID,
ALERT_RULE_UUID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ describe('mappingFromFieldMap', () => {
producer: {
type: 'keyword',
},
revision: {
type: 'long',
},
rule_type_id: {
type: 'keyword',
},
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/alerting/common/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export type SanitizedRuleConfig = Pick<
| 'throttle'
| 'notifyWhen'
| 'muteAll'
| 'revision'
| 'snoozeSchedule'
> & {
producer: string;
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/alerting/server/task_runner/task_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ export class TaskRunner<
enabled,
actions,
muteAll,
revision,
snoozeSchedule,
} = rule;
const {
Expand Down Expand Up @@ -379,6 +380,7 @@ export class TaskRunner<
tags,
consumer,
producer: ruleType.producer,
revision,
ruleTypeId: rule.alertTypeId,
ruleTypeName: ruleType.name,
enabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const mockOptions = {
throttle: null,
notifyWhen: null,
producer: '',
revision: 0,
ruleTypeId: '',
ruleTypeName: '',
muteAll: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const mockOptions = {
throttle: null,
notifyWhen: null,
producer: '',
revision: 0,
ruleTypeId: '',
ruleTypeName: '',
muteAll: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const activeAlert: TopAlert = {
'kibana.alert.rule.producer': 'logs',
'kibana.alert.rule.consumer': 'logs',
'kibana.alert.rule.category': 'Log threshold',
'kibana.alert.rule.revision': 0,
'kibana.alert.start': '2021-09-02T12:54:09.674Z',
'kibana.alert.rule.rule_type_id': 'logs.alert.document.count',
'event.action': 'active',
Expand Down Expand Up @@ -97,6 +98,7 @@ const recoveredAlert: TopAlert = {
'kibana.alert.rule.producer': 'infrastructure',
'kibana.alert.rule.consumer': 'infrastructure',
'kibana.alert.rule.category': 'Inventory',
'kibana.alert.rule.revision': 0,
'kibana.alert.start': '2021-09-02T13:05:36.699Z',
'kibana.alert.rule.rule_type_id': 'metrics.alert.inventory.threshold',
'event.action': 'close',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe('useFetchAlertDetail', () => {
'kibana.alert.rule.execution.uuid': 'e62c418d-734d-47e7-bbeb-e6f182f5fb45',
'kibana.alert.rule.name': 'A super rule',
'kibana.alert.rule.producer': 'infrastructure',
'kibana.alert.rule.revision': 0,
'kibana.alert.rule.rule_type_id': 'metrics.alert.threshold',
'kibana.alert.rule.uuid': '69411af0-82a2-11ec-8139-c1568734434e',
'kibana.space_ids': ['default'],
Expand Down Expand Up @@ -124,6 +125,7 @@ describe('useFetchAlertDetail', () => {
"kibana.alert.rule.execution.uuid": "e62c418d-734d-47e7-bbeb-e6f182f5fb45",
"kibana.alert.rule.name": "A super rule",
"kibana.alert.rule.producer": "infrastructure",
"kibana.alert.rule.revision": 0,
"kibana.alert.rule.rule_type_id": "metrics.alert.threshold",
"kibana.alert.rule.tags": Array [],
"kibana.alert.rule.uuid": "69411af0-82a2-11ec-8139-c1568734434e",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
ALERT_RULE_CONSUMER,
ALERT_RULE_NAME,
ALERT_RULE_PRODUCER,
ALERT_RULE_REVISION,
ALERT_RULE_TAGS,
ALERT_RULE_TYPE_ID,
ALERT_RULE_UUID,
Expand Down Expand Up @@ -46,6 +47,7 @@ export const alert: TopAlert = {
[ALERT_RULE_PRODUCER]: 'logs',
[ALERT_RULE_CONSUMER]: 'logs',
[ALERT_RULE_CATEGORY]: 'Log threshold',
[ALERT_RULE_REVISION]: 0,
[ALERT_START]: '2021-09-02T12:54:09.674Z',
[ALERT_RULE_TYPE_ID]: 'logs.alert.document.count',
[EVENT_ACTION]: 'active',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ it('matches snapshot', () => {
"required": false,
"type": "keyword",
},
"kibana.alert.rule.revision": Object {
"array": false,
"required": true,
"type": "long",
},
"kibana.alert.rule.rule_id": Object {
"array": false,
"required": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ describe('parseTechnicalFields', () => {
'kibana.alert.rule.rule_type_id': ['metrics.alert.threshold'],
'event.action': ['active'],
'kibana.alert.rule.name': ['Uptime'],
'kibana.alert.rule.revision': 0,
'kibana.alert.uuid': ['f31f5726-3c47-4c88-bc42-4e1fbde17e34'],
'kibana.space_ids': ['default'],
'kibana.version': ['8.1.0'],
Expand Down Expand Up @@ -102,6 +103,7 @@ describe('parseTechnicalFields', () => {
'kibana.alert.rule.category': ['Metric threshold'],
'kibana.alert.rule.rule_type_id': ['metrics.alert.threshold'],
'kibana.alert.rule.name': ['Uptime'],
'kibana.alert.rule.revision': 0,
'kibana.alert.uuid': ['f31f5726-3c47-4c88-bc42-4e1fbde17e34'],
'kibana.space_ids': ['default'],
};
Expand Down
29 changes: 29 additions & 0 deletions x-pack/plugins/rule_registry/common/schemas/8.8.0/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { ALERT_RULE_REVISION } from '@kbn/rule-data-utils';
import { CommonAlertFields870 } from '../8.7.0';

/* DO NOT MODIFY THIS SCHEMA TO ADD NEW FIELDS. These types represent the alerts that shipped in 8.8.0.
Any changes to these types should be bug fixes so the types more accurately represent the alerts from 8.8.0.

If you are adding new fields for a new release of Kibana, create a new sibling folder to this one
for the version to be released and add the field(s) to the schema in that folder.

Then, update `../index.ts` to import from the new folder that has the latest schemas, add the
new schemas to the union of all alert schemas, and re-export the new schemas as the `*Latest` schemas.
*/

export interface RevisionField880 {
[ALERT_RULE_REVISION]: number;
}

export type CommonAlertFields880 = CommonAlertFields870 & RevisionField880;

export type CommonAlertFieldName880 = keyof CommonAlertFields880;

export type AlertWithCommonFields880<T> = T & CommonAlertFields880;
17 changes: 10 additions & 7 deletions x-pack/plugins/rule_registry/common/schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@
*/

import type {
CommonAlertFieldName870,
AlertWithSuppressionFields870,
SuppressionFields870,
CommonAlertIdFieldName870,
CommonAlertFields870,
AlertWithCommonFields870,
} from './8.7.0';

import type { AlertWithSuppressionFields870, SuppressionFields870 } from './8.7.0';
import type {
AlertWithCommonFields880,
CommonAlertFieldName880,
CommonAlertFields880,
} from './8.8.0';

export type {
AlertWithSuppressionFields870 as AlertWithSuppressionFieldsLatest,
SuppressionFields870 as SuppressionFieldsLatest,
CommonAlertFieldName870 as CommonAlertFieldNameLatest,
CommonAlertFieldName880 as CommonAlertFieldNameLatest,
CommonAlertIdFieldName870 as CommonAlertIdFieldNameLatest,
CommonAlertFields870 as CommonAlertFieldsLatest,
AlertWithCommonFields870 as AlertWithCommonFieldsLatest,
CommonAlertFields880 as CommonAlertFieldsLatest,
AlertWithCommonFields880 as AlertWithCommonFieldsLatest,
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ALERT_RULE_CONSUMER,
ALERT_RULE_NAME,
ALERT_RULE_PRODUCER,
ALERT_RULE_REVISION,
ALERT_RISK_SCORE,
ALERT_RULE_TYPE_ID,
ALERT_RULE_UUID,
Expand All @@ -36,6 +37,7 @@ const getMockAlert = (): ParsedTechnicalFields & ParsedExperimentalFields => ({
[ALERT_RULE_CONSUMER]: 'apm',
[ALERT_RULE_NAME]: 'Check error rate',
[ALERT_RULE_PRODUCER]: 'apm',
[ALERT_RULE_REVISION]: 0,
[ALERT_RISK_SCORE]: 20,
[ALERT_RULE_TYPE_ID]: 'fake-rule-type-id',
[ALERT_RULE_UUID]: 'fake-rule-uuid',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ function createRule(shouldWriteAlerts: boolean = true) {
name: 'name',
notifyWhen: 'onActionGroupChange',
producer: 'producer',
revision: 0,
ruleTypeId: 'ruleTypeId',
ruleTypeName: 'ruleTypeName',
schedule: {
Expand Down Expand Up @@ -255,6 +256,7 @@ describe('createLifecycleRuleTypeFactory', () => {
"threshold": 1,
},
"kibana.alert.rule.producer": "producer",
"kibana.alert.rule.revision": 0,
"kibana.alert.rule.rule_type_id": "ruleTypeId",
"kibana.alert.rule.tags": Array [
"tags",
Expand Down Expand Up @@ -291,6 +293,7 @@ describe('createLifecycleRuleTypeFactory', () => {
"threshold": 1,
},
"kibana.alert.rule.producer": "producer",
"kibana.alert.rule.revision": 0,
"kibana.alert.rule.rule_type_id": "ruleTypeId",
"kibana.alert.rule.tags": Array [
"tags",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
ALERT_RULE_TAGS,
TIMESTAMP,
ALERT_RULE_PARAMETERS,
ALERT_RULE_REVISION,
} from '@kbn/rule-data-utils';

import { RuleExecutorOptions } from '@kbn/alerting-plugin/server';
Expand All @@ -32,6 +33,7 @@ export const getCommonAlertFields = (
[ALERT_RULE_EXECUTION_UUID]: options.executionId,
[ALERT_RULE_NAME]: options.rule.name,
[ALERT_RULE_PRODUCER]: options.rule.producer,
[ALERT_RULE_REVISION]: options.rule.revision,
[ALERT_RULE_TYPE_ID]: options.rule.ruleTypeId,
[ALERT_RULE_UUID]: options.rule.id,
[SPACE_IDS]: [options.spaceId],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const createDefaultAlertExecutorOptions = <
createdAt,
updatedAt,
notifyWhen: null,
revision: 0,
ruleTypeId: 'RULE_TYPE_ID',
ruleTypeName: 'RULE_TYPE_NAME',
muteAll: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ describe('legacyRules_notification_alert_type', () => {
tags: [],
consumer: 'foo',
producer: 'foo',
revision: 0,
ruleTypeId: 'ruleType',
ruleTypeName: 'Name of rule',
enabled: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ export const previewRulesRoute = async (
createdAt: new Date(),
createdBy: username ?? 'preview-created-by',
producer: 'preview-producer',
revision: 0,
ruleTypeId,
ruleTypeName,
updatedAt: new Date(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export const getRuleConfigMock = (type: string = 'rule-type'): SanitizedRuleConf
ruleTypeId: `${type}-id`,
ruleTypeName: type,
muteAll: false,
revision: 0,
snoozeSchedule: [],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
ALERT_RULE_NAME,
ALERT_RULE_PARAMETERS,
ALERT_RULE_PRODUCER,
ALERT_RULE_REVISION,
ALERT_RULE_TAGS,
ALERT_RULE_TYPE_ID,
ALERT_RULE_UUID,
Expand Down Expand Up @@ -71,6 +72,7 @@ describe('searchAfterAndBulkCreate', () => {
[ALERT_RULE_EXECUTION_UUID]: '97e8f53a-4971-4935-bb54-9b8f86930cc7',
[ALERT_RULE_NAME]: 'rule-name',
[ALERT_RULE_PRODUCER]: 'siem',
[ALERT_RULE_REVISION]: 0,
[ALERT_RULE_TYPE_ID]: 'siem.queryRule',
[ALERT_RULE_UUID]: '2e051244-b3c6-4779-a241-e1b4f0beceb9',
[SPACE_IDS]: ['default'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ async function invokeExecutor({
ruleTypeId: '',
ruleTypeName: '',
enabled: true,
revision: 0,
schedule: {
interval: '1h',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ describe('ruleType', () => {
ruleTypeId: '',
ruleTypeName: '',
enabled: true,
revision: 0,
schedule: {
interval: '1h',
},
Expand Down Expand Up @@ -272,6 +273,7 @@ describe('ruleType', () => {
ruleTypeId: '',
ruleTypeName: '',
enabled: true,
revision: 0,
schedule: {
interval: '1h',
},
Expand Down Expand Up @@ -338,6 +340,7 @@ describe('ruleType', () => {
ruleTypeId: '',
ruleTypeName: '',
enabled: true,
revision: 0,
schedule: {
interval: '1h',
},
Expand Down Expand Up @@ -403,6 +406,7 @@ describe('ruleType', () => {
ruleTypeId: '',
ruleTypeName: '',
enabled: true,
revision: 0,
schedule: {
interval: '1h',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export default function alertTests({ getService }: FtrProviderContext) {
};
}),
producer: 'alertsFixture',
revision: 0,
ruleTypeId: 'test.always-firing',
ruleTypeName: 'Test: Always Firing',
muteAll: false,
Expand Down Expand Up @@ -432,6 +433,7 @@ instanceStateValue: true
};
}),
producer: 'alertsFixture',
revision: 1,
ruleTypeId: 'test.always-firing',
ruleTypeName: 'Test: Always Firing',
muteAll: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export function alertTests({ getService }: FtrProviderContext, space: Space) {
};
}),
producer: 'alertsFixture',
revision: 0,
ruleTypeId: 'test.always-firing',
ruleTypeName: 'Test: Always Firing',
muteAll: false,
Expand Down
Loading