From 941386929003d20088f7827c9d045da688698441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20C=C3=B4t=C3=A9?= Date: Tue, 19 Apr 2022 09:04:19 -0400 Subject: [PATCH] Rename "scheduled actions" to "generated actions" (#130315) * Rename number_of_scheduled_actions to number_of_generated_actions * Rename scheduled actions to generated actions in UI * Rename num_scheduled_actions to num_generated_actions * Rename telemetry field terminology * Rename numScheduledActions to numGeneratedActions * Some more renaming * Rename numberOfScheduledActions to numberOfGeneratedActions Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../alerting/common/execution_log_types.ts | 4 +- x-pack/plugins/alerting/common/rule.ts | 2 +- .../alerting/common/rule_task_instance.ts | 2 +- .../lib/get_execution_log_aggregation.test.ts | 40 +++++++++--------- .../lib/get_execution_log_aggregation.ts | 14 +++---- .../server/lib/rule_execution_status.test.ts | 16 +++---- .../server/lib/rule_execution_status.ts | 2 +- .../routes/get_rule_execution_log.test.ts | 4 +- .../server/routes/get_rule_execution_log.ts | 2 +- .../tests/get_execution_log.test.ts | 10 ++--- .../create_execution_handler.test.ts | 6 +-- .../task_runner/create_execution_handler.ts | 2 +- .../alerting/server/task_runner/fixtures.ts | 6 +-- .../server/task_runner/task_runner.test.ts | 42 +++++++++---------- .../server/task_runner/task_runner.ts | 6 +-- .../task_runner/task_runner_cancel.test.ts | 10 ++--- .../alerting/server/task_runner/types.ts | 2 +- .../server/usage/alerting_telemetry.test.ts | 4 +- .../server/usage/alerting_telemetry.ts | 16 +++---- .../server/usage/alerting_usage_collector.ts | 12 +++--- x-pack/plugins/alerting/server/usage/task.ts | 8 ++-- x-pack/plugins/alerting/server/usage/types.ts | 4 +- .../plugins/event_log/generated/mappings.json | 4 +- x-pack/plugins/event_log/generated/schemas.ts | 2 +- x-pack/plugins/event_log/scripts/mappings.js | 2 +- .../schema/xpack_plugins.json | 4 +- .../public/application/constants/index.ts | 2 +- .../components/rule_event_log_list.tsx | 6 +-- .../tests/telemetry/alerting_telemetry.ts | 42 +++++++++---------- .../tests/alerting/get_execution_log.ts | 8 ++-- 30 files changed, 142 insertions(+), 142 deletions(-) diff --git a/x-pack/plugins/alerting/common/execution_log_types.ts b/x-pack/plugins/alerting/common/execution_log_types.ts index df74c46ad9b43..4fff1f14ca5bd 100644 --- a/x-pack/plugins/alerting/common/execution_log_types.ts +++ b/x-pack/plugins/alerting/common/execution_log_types.ts @@ -12,7 +12,7 @@ export const executionLogSortableColumns = [ 'es_search_duration', 'schedule_delay', 'num_triggered_actions', - 'num_scheduled_actions', + 'num_generated_actions', ] as const; export type ExecutionLogSortFields = typeof executionLogSortableColumns[number]; @@ -27,7 +27,7 @@ export interface IExecutionLog { num_new_alerts: number; num_recovered_alerts: number; num_triggered_actions: number; - num_scheduled_actions: number; + num_generated_actions: number; num_succeeded_actions: number; num_errored_actions: number; total_search_duration_ms: number; diff --git a/x-pack/plugins/alerting/common/rule.ts b/x-pack/plugins/alerting/common/rule.ts index 14566464fcb1e..3d3b66f18a436 100644 --- a/x-pack/plugins/alerting/common/rule.ts +++ b/x-pack/plugins/alerting/common/rule.ts @@ -50,7 +50,7 @@ export enum RuleExecutionStatusWarningReasons { export interface RuleExecutionStatus { status: RuleExecutionStatuses; numberOfTriggeredActions?: number; - numberOfScheduledActions?: number; + numberOfGeneratedActions?: number; metrics?: RuleExecutionMetrics; lastExecutionDate: Date; lastDuration?: number; diff --git a/x-pack/plugins/alerting/common/rule_task_instance.ts b/x-pack/plugins/alerting/common/rule_task_instance.ts index 01d97efd57b15..8465222c0ff62 100644 --- a/x-pack/plugins/alerting/common/rule_task_instance.ts +++ b/x-pack/plugins/alerting/common/rule_task_instance.ts @@ -24,7 +24,7 @@ const ruleExecutionMetricsSchema = t.partial({ const alertExecutionStore = t.partial({ numberOfTriggeredActions: t.number, - numberOfScheduledActions: t.number, + numberOfGeneratedActions: t.number, triggeredActionsStatus: t.string, }); diff --git a/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.test.ts b/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.test.ts index 80090effca9d1..6927ef86dd47c 100644 --- a/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.test.ts +++ b/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.test.ts @@ -83,7 +83,7 @@ describe('getExecutionLogAggregation', () => { sort: [{ notsortable: { order: 'asc' } }], }); }).toThrowErrorMatchingInlineSnapshot( - `"Invalid sort field \\"notsortable\\" - must be one of [timestamp,execution_duration,total_search_duration,es_search_duration,schedule_delay,num_triggered_actions,num_scheduled_actions]"` + `"Invalid sort field \\"notsortable\\" - must be one of [timestamp,execution_duration,total_search_duration,es_search_duration,schedule_delay,num_triggered_actions,num_generated_actions]"` ); }); @@ -95,7 +95,7 @@ describe('getExecutionLogAggregation', () => { sort: [{ notsortable: { order: 'asc' } }, { timestamp: { order: 'asc' } }], }); }).toThrowErrorMatchingInlineSnapshot( - `"Invalid sort field \\"notsortable\\" - must be one of [timestamp,execution_duration,total_search_duration,es_search_duration,schedule_delay,num_triggered_actions,num_scheduled_actions]"` + `"Invalid sort field \\"notsortable\\" - must be one of [timestamp,execution_duration,total_search_duration,es_search_duration,schedule_delay,num_triggered_actions,num_generated_actions]"` ); }); @@ -211,9 +211,9 @@ describe('getExecutionLogAggregation', () => { field: 'kibana.alert.rule.execution.metrics.number_of_triggered_actions', }, }, - numScheduledActions: { + numGeneratedActions: { max: { - field: 'kibana.alert.rule.execution.metrics.number_of_scheduled_actions', + field: 'kibana.alert.rule.execution.metrics.number_of_generated_actions', }, }, executionDuration: { max: { field: 'event.duration' } }, @@ -298,7 +298,7 @@ describe('formatExecutionLogResult', () => { numTriggeredActions: { value: 5.0, }, - numScheduledActions: { + numGeneratedActions: { value: 5.0, }, outcomeAndMessage: { @@ -383,7 +383,7 @@ describe('formatExecutionLogResult', () => { numTriggeredActions: { value: 5.0, }, - numScheduledActions: { + numGeneratedActions: { value: 5.0, }, outcomeAndMessage: { @@ -463,7 +463,7 @@ describe('formatExecutionLogResult', () => { num_new_alerts: 5, num_recovered_alerts: 0, num_triggered_actions: 5, - num_scheduled_actions: 5, + num_generated_actions: 5, num_succeeded_actions: 5, num_errored_actions: 0, total_search_duration_ms: 0, @@ -482,7 +482,7 @@ describe('formatExecutionLogResult', () => { num_new_alerts: 5, num_recovered_alerts: 5, num_triggered_actions: 5, - num_scheduled_actions: 5, + num_generated_actions: 5, num_succeeded_actions: 5, num_errored_actions: 0, total_search_duration_ms: 0, @@ -532,7 +532,7 @@ describe('formatExecutionLogResult', () => { numTriggeredActions: { value: 5.0, }, - numScheduledActions: { + numGeneratedActions: { value: 5.0, }, outcomeAndMessage: { @@ -620,7 +620,7 @@ describe('formatExecutionLogResult', () => { numTriggeredActions: { value: 5.0, }, - numScheduledActions: { + numGeneratedActions: { value: 5.0, }, outcomeAndMessage: { @@ -700,7 +700,7 @@ describe('formatExecutionLogResult', () => { num_new_alerts: 5, num_recovered_alerts: 0, num_triggered_actions: 5, - num_scheduled_actions: 5, + num_generated_actions: 5, num_succeeded_actions: 5, num_errored_actions: 0, total_search_duration_ms: 0, @@ -719,7 +719,7 @@ describe('formatExecutionLogResult', () => { num_new_alerts: 5, num_recovered_alerts: 5, num_triggered_actions: 5, - num_scheduled_actions: 5, + num_generated_actions: 5, num_succeeded_actions: 5, num_errored_actions: 0, total_search_duration_ms: 0, @@ -769,7 +769,7 @@ describe('formatExecutionLogResult', () => { numTriggeredActions: { value: 0.0, }, - numScheduledActions: { + numGeneratedActions: { value: 0.0, }, outcomeAndMessage: { @@ -849,7 +849,7 @@ describe('formatExecutionLogResult', () => { numTriggeredActions: { value: 5.0, }, - numScheduledActions: { + numGeneratedActions: { value: 5.0, }, outcomeAndMessage: { @@ -929,7 +929,7 @@ describe('formatExecutionLogResult', () => { num_new_alerts: 0, num_recovered_alerts: 0, num_triggered_actions: 0, - num_scheduled_actions: 0, + num_generated_actions: 0, num_succeeded_actions: 0, num_errored_actions: 0, total_search_duration_ms: 0, @@ -948,7 +948,7 @@ describe('formatExecutionLogResult', () => { num_new_alerts: 5, num_recovered_alerts: 5, num_triggered_actions: 5, - num_scheduled_actions: 5, + num_generated_actions: 5, num_succeeded_actions: 5, num_errored_actions: 0, total_search_duration_ms: 0, @@ -998,7 +998,7 @@ describe('formatExecutionLogResult', () => { numTriggeredActions: { value: 5.0, }, - numScheduledActions: { + numGeneratedActions: { value: 5.0, }, outcomeAndMessage: { @@ -1083,7 +1083,7 @@ describe('formatExecutionLogResult', () => { numTriggeredActions: { value: 5.0, }, - numScheduledActions: { + numGeneratedActions: { value: 5.0, }, outcomeAndMessage: { @@ -1163,7 +1163,7 @@ describe('formatExecutionLogResult', () => { num_new_alerts: 5, num_recovered_alerts: 5, num_triggered_actions: 5, - num_scheduled_actions: 5, + num_generated_actions: 5, num_succeeded_actions: 0, num_errored_actions: 5, total_search_duration_ms: 0, @@ -1182,7 +1182,7 @@ describe('formatExecutionLogResult', () => { num_new_alerts: 5, num_recovered_alerts: 5, num_triggered_actions: 5, - num_scheduled_actions: 5, + num_generated_actions: 5, num_succeeded_actions: 5, num_errored_actions: 0, total_search_duration_ms: 0, diff --git a/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.ts b/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.ts index 851b96bf0299f..03e1077b02eda 100644 --- a/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.ts +++ b/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.ts @@ -26,8 +26,8 @@ const ES_SEARCH_DURATION_FIELD = 'kibana.alert.rule.execution.metrics.es_search_ const TOTAL_SEARCH_DURATION_FIELD = 'kibana.alert.rule.execution.metrics.total_search_duration_ms'; const NUMBER_OF_TRIGGERED_ACTIONS_FIELD = 'kibana.alert.rule.execution.metrics.number_of_triggered_actions'; -const NUMBER_OF_SCHEDULED_ACTIONS_FIELD = - 'kibana.alert.rule.execution.metrics.number_of_scheduled_actions'; +const NUMBER_OF_GENERATED_ACTIONS_FIELD = + 'kibana.alert.rule.execution.metrics.number_of_generated_actions'; const EXECUTION_UUID_FIELD = 'kibana.alert.rule.execution.uuid'; const Millis2Nanos = 1000 * 1000; @@ -59,7 +59,7 @@ interface IExecutionUuidAggBucket extends estypes.AggregationsStringTermsBucketK esSearchDuration: estypes.AggregationsMaxAggregate; totalSearchDuration: estypes.AggregationsMaxAggregate; numTriggeredActions: estypes.AggregationsMaxAggregate; - numScheduledActions: estypes.AggregationsMaxAggregate; + numGeneratedActions: estypes.AggregationsMaxAggregate; outcomeAndMessage: estypes.AggregationsTopHitsAggregate; }; alertCounts: IAlertCounts; @@ -90,7 +90,7 @@ const ExecutionLogSortFields: Record = { es_search_duration: 'ruleExecution>esSearchDuration', schedule_delay: 'ruleExecution>scheduleDelay', num_triggered_actions: 'ruleExecution>numTriggeredActions', - num_scheduled_actions: 'ruleExecution>numScheduledActions', + num_generated_actions: 'ruleExecution>numGeneratedActions', }; export function getExecutionLogAggregation({ page, perPage, sort }: IExecutionLogAggOptions) { @@ -204,9 +204,9 @@ export function getExecutionLogAggregation({ page, perPage, sort }: IExecutionLo field: NUMBER_OF_TRIGGERED_ACTIONS_FIELD, }, }, - numScheduledActions: { + numGeneratedActions: { max: { - field: NUMBER_OF_SCHEDULED_ACTIONS_FIELD, + field: NUMBER_OF_GENERATED_ACTIONS_FIELD, }, }, executionDuration: { @@ -285,7 +285,7 @@ function formatExecutionLogAggBucket(bucket: IExecutionUuidAggBucket): IExecutio num_new_alerts: bucket?.alertCounts?.buckets?.newAlerts?.doc_count ?? 0, num_recovered_alerts: bucket?.alertCounts?.buckets?.recoveredAlerts?.doc_count ?? 0, num_triggered_actions: bucket?.ruleExecution?.numTriggeredActions?.value ?? 0, - num_scheduled_actions: bucket?.ruleExecution?.numScheduledActions?.value ?? 0, + num_generated_actions: bucket?.ruleExecution?.numGeneratedActions?.value ?? 0, num_succeeded_actions: actionExecutionSuccess, num_errored_actions: actionExecutionError, total_search_duration_ms: bucket?.ruleExecution?.totalSearchDuration?.value ?? 0, diff --git a/x-pack/plugins/alerting/server/lib/rule_execution_status.test.ts b/x-pack/plugins/alerting/server/lib/rule_execution_status.test.ts index e28646af55fec..19da38e283a11 100644 --- a/x-pack/plugins/alerting/server/lib/rule_execution_status.test.ts +++ b/x-pack/plugins/alerting/server/lib/rule_execution_status.test.ts @@ -34,13 +34,13 @@ describe('RuleExecutionStatus', () => { const status = executionStatusFromState({ alertExecutionStore: { numberOfTriggeredActions: 0, - numberOfScheduledActions: 0, + numberOfGeneratedActions: 0, triggeredActionsStatus: ActionsCompletion.COMPLETE, }, } as RuleExecutionState); checkDateIsNearNow(status.lastExecutionDate); expect(status.numberOfTriggeredActions).toBe(0); - expect(status.numberOfScheduledActions).toBe(0); + expect(status.numberOfGeneratedActions).toBe(0); expect(status.status).toBe('ok'); expect(status.error).toBe(undefined); expect(status.warning).toBe(undefined); @@ -51,14 +51,14 @@ describe('RuleExecutionStatus', () => { alertInstances: {}, alertExecutionStore: { numberOfTriggeredActions: 0, - numberOfScheduledActions: 0, + numberOfGeneratedActions: 0, triggeredActionsStatus: ActionsCompletion.COMPLETE, }, metrics, }); checkDateIsNearNow(status.lastExecutionDate); expect(status.numberOfTriggeredActions).toBe(0); - expect(status.numberOfScheduledActions).toBe(0); + expect(status.numberOfGeneratedActions).toBe(0); expect(status.status).toBe('ok'); expect(status.error).toBe(undefined); expect(status.warning).toBe(undefined); @@ -70,14 +70,14 @@ describe('RuleExecutionStatus', () => { alertInstances: { a: {} }, alertExecutionStore: { numberOfTriggeredActions: 0, - numberOfScheduledActions: 0, + numberOfGeneratedActions: 0, triggeredActionsStatus: ActionsCompletion.COMPLETE, }, metrics, }); checkDateIsNearNow(status.lastExecutionDate); expect(status.numberOfTriggeredActions).toBe(0); - expect(status.numberOfScheduledActions).toBe(0); + expect(status.numberOfGeneratedActions).toBe(0); expect(status.status).toBe('active'); expect(status.error).toBe(undefined); expect(status.warning).toBe(undefined); @@ -88,7 +88,7 @@ describe('RuleExecutionStatus', () => { const status = executionStatusFromState({ alertExecutionStore: { numberOfTriggeredActions: 1, - numberOfScheduledActions: 2, + numberOfGeneratedActions: 2, triggeredActionsStatus: ActionsCompletion.COMPLETE, }, alertInstances: { a: {} }, @@ -96,7 +96,7 @@ describe('RuleExecutionStatus', () => { }); checkDateIsNearNow(status.lastExecutionDate); expect(status.numberOfTriggeredActions).toBe(1); - expect(status.numberOfScheduledActions).toBe(2); + expect(status.numberOfGeneratedActions).toBe(2); expect(status.status).toBe('active'); expect(status.error).toBe(undefined); expect(status.warning).toBe(undefined); diff --git a/x-pack/plugins/alerting/server/lib/rule_execution_status.ts b/x-pack/plugins/alerting/server/lib/rule_execution_status.ts index 11e7946669824..f4161022e9544 100644 --- a/x-pack/plugins/alerting/server/lib/rule_execution_status.ts +++ b/x-pack/plugins/alerting/server/lib/rule_execution_status.ts @@ -35,7 +35,7 @@ export function executionStatusFromState(state: RuleExecutionState): RuleExecuti return { metrics: state.metrics, numberOfTriggeredActions: state.alertExecutionStore.numberOfTriggeredActions, - numberOfScheduledActions: state.alertExecutionStore.numberOfScheduledActions, + numberOfGeneratedActions: state.alertExecutionStore.numberOfGeneratedActions, lastExecutionDate: new Date(), status, ...(hasIncompleteAlertExecution && { diff --git a/x-pack/plugins/alerting/server/routes/get_rule_execution_log.test.ts b/x-pack/plugins/alerting/server/routes/get_rule_execution_log.test.ts index f55f3e9dc1c4d..cbcff65cdbdca 100644 --- a/x-pack/plugins/alerting/server/routes/get_rule_execution_log.test.ts +++ b/x-pack/plugins/alerting/server/routes/get_rule_execution_log.test.ts @@ -38,7 +38,7 @@ describe('getRuleExecutionLogRoute', () => { num_new_alerts: 5, num_recovered_alerts: 0, num_triggered_actions: 5, - num_scheduled_actions: 5, + num_generated_actions: 5, num_succeeded_actions: 5, num_errored_actions: 0, total_search_duration_ms: 0, @@ -57,7 +57,7 @@ describe('getRuleExecutionLogRoute', () => { num_new_alerts: 5, num_recovered_alerts: 5, num_triggered_actions: 5, - num_scheduled_actions: 5, + num_generated_actions: 5, num_succeeded_actions: 5, num_errored_actions: 0, total_search_duration_ms: 0, diff --git a/x-pack/plugins/alerting/server/routes/get_rule_execution_log.ts b/x-pack/plugins/alerting/server/routes/get_rule_execution_log.ts index b8717e4ef6cab..6f07c8daa14e7 100644 --- a/x-pack/plugins/alerting/server/routes/get_rule_execution_log.ts +++ b/x-pack/plugins/alerting/server/routes/get_rule_execution_log.ts @@ -25,7 +25,7 @@ const sortFieldSchema = schema.oneOf([ schema.object({ es_search_duration: schema.object({ order: sortOrderSchema }) }), schema.object({ schedule_delay: schema.object({ order: sortOrderSchema }) }), schema.object({ num_triggered_actions: schema.object({ order: sortOrderSchema }) }), - schema.object({ num_scheduled_actions: schema.object({ order: sortOrderSchema }) }), + schema.object({ num_generated_actions: schema.object({ order: sortOrderSchema }) }), ]); const sortFieldsSchema = schema.arrayOf(sortFieldSchema, { diff --git a/x-pack/plugins/alerting/server/rules_client/tests/get_execution_log.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/get_execution_log.test.ts index 2cc59f7bfbba7..0eee41402000f 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/get_execution_log.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/get_execution_log.test.ts @@ -131,7 +131,7 @@ const aggregateResults = { numTriggeredActions: { value: 5.0, }, - numScheduledActions: { + numGeneratedActions: { value: 5.0, }, outcomeAndMessage: { @@ -216,7 +216,7 @@ const aggregateResults = { numTriggeredActions: { value: 5.0, }, - numScheduledActions: { + numGeneratedActions: { value: 5.0, }, outcomeAndMessage: { @@ -635,7 +635,7 @@ describe('getExecutionLogForRule()', () => { num_new_alerts: 5, num_recovered_alerts: 0, num_triggered_actions: 5, - num_scheduled_actions: 5, + num_generated_actions: 5, num_succeeded_actions: 5, num_errored_actions: 0, total_search_duration_ms: 0, @@ -654,7 +654,7 @@ describe('getExecutionLogForRule()', () => { num_new_alerts: 5, num_recovered_alerts: 5, num_triggered_actions: 5, - num_scheduled_actions: 5, + num_generated_actions: 5, num_succeeded_actions: 5, num_errored_actions: 0, total_search_duration_ms: 0, @@ -929,7 +929,7 @@ describe('getExecutionLogForRule()', () => { getExecutionLogByIdParams({ sort: [{ foo: { order: 'desc' } }] }) ) ).rejects.toMatchInlineSnapshot( - `[Error: Invalid sort field "foo" - must be one of [timestamp,execution_duration,total_search_duration,es_search_duration,schedule_delay,num_triggered_actions,num_scheduled_actions]]` + `[Error: Invalid sort field "foo" - must be one of [timestamp,execution_duration,total_search_duration,es_search_duration,schedule_delay,num_triggered_actions,num_generated_actions]]` ); }); diff --git a/x-pack/plugins/alerting/server/task_runner/create_execution_handler.test.ts b/x-pack/plugins/alerting/server/task_runner/create_execution_handler.test.ts index addd2b99b5efd..db84953291c73 100644 --- a/x-pack/plugins/alerting/server/task_runner/create_execution_handler.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/create_execution_handler.test.ts @@ -122,7 +122,7 @@ describe('Create Execution Handler', () => { ); alertExecutionStore = { numberOfTriggeredActions: 0, - numberOfScheduledActions: 0, + numberOfGeneratedActions: 0, triggeredActionsStatus: ActionsCompletion.COMPLETE, }; }); @@ -508,7 +508,7 @@ describe('Create Execution Handler', () => { alertExecutionStore = { numberOfTriggeredActions: 0, - numberOfScheduledActions: 0, + numberOfGeneratedActions: 0, triggeredActionsStatus: ActionsCompletion.COMPLETE, }; @@ -521,7 +521,7 @@ describe('Create Execution Handler', () => { }); expect(alertExecutionStore.numberOfTriggeredActions).toBe(2); - expect(alertExecutionStore.numberOfScheduledActions).toBe(3); + expect(alertExecutionStore.numberOfGeneratedActions).toBe(3); expect(alertExecutionStore.triggeredActionsStatus).toBe(ActionsCompletion.PARTIAL); expect(actionsClient.enqueueExecution).toHaveBeenCalledTimes(2); }); diff --git a/x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts b/x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts index e9452e3cf7c8f..b6b6eb0eaf880 100644 --- a/x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts +++ b/x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts @@ -107,7 +107,7 @@ export function createExecutionHandler< }), })); - alertExecutionStore.numberOfScheduledActions += actions.length; + alertExecutionStore.numberOfGeneratedActions += actions.length; const ruleLabel = `${ruleType.id}:${ruleId}: '${ruleName}'`; diff --git a/x-pack/plugins/alerting/server/task_runner/fixtures.ts b/x-pack/plugins/alerting/server/task_runner/fixtures.ts index 1f41ce1fc0529..7a851a713c961 100644 --- a/x-pack/plugins/alerting/server/task_runner/fixtures.ts +++ b/x-pack/plugins/alerting/server/task_runner/fixtures.ts @@ -216,7 +216,7 @@ export const generateEventLog = ({ actionId, status, numberOfTriggeredActions, - numberOfScheduledActions, + numberOfGeneratedActions, savedObjects = [generateAlertSO('1')], }: GeneratorParams = {}) => ({ ...(status === 'error' && { @@ -240,10 +240,10 @@ export const generateEventLog = ({ ...(consumer && { consumer }), execution: { uuid: '5f6aa57d-3e22-484e-bae8-cbed868f4d28', - ...((!isNil(numberOfTriggeredActions) || !isNil(numberOfScheduledActions)) && { + ...((!isNil(numberOfTriggeredActions) || !isNil(numberOfGeneratedActions)) && { metrics: { number_of_triggered_actions: numberOfTriggeredActions, - number_of_scheduled_actions: numberOfScheduledActions, + number_of_generated_actions: numberOfGeneratedActions, number_of_searches: 3, es_search_duration_ms: 33, total_search_duration_ms: 23423, diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts b/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts index bba5488afe1e1..5ed33093cd8bc 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts @@ -235,7 +235,7 @@ describe('Task Runner', () => { expect(logger.debug).nthCalledWith(1, 'executing rule test:1 at 1970-01-01T00:00:00.000Z'); expect(logger.debug).nthCalledWith( 2, - 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":0,"numberOfScheduledActions":0,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"ok"}' + 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":0,"numberOfGeneratedActions":0,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"ok"}' ); const eventLogger = taskRunnerFactoryInitializerParams.eventLogger; @@ -315,7 +315,7 @@ describe('Task Runner', () => { ); expect(logger.debug).nthCalledWith( 3, - 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":1,"numberOfScheduledActions":1,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"active"}' + 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":1,"numberOfGeneratedActions":1,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"active"}' ); const eventLogger = customTaskRunnerFactoryInitializerParams.eventLogger; @@ -371,7 +371,7 @@ describe('Task Runner', () => { outcome: 'success', status: 'active', numberOfTriggeredActions: 1, - numberOfScheduledActions: 1, + numberOfGeneratedActions: 1, task: true, consumer: 'bar', }) @@ -423,7 +423,7 @@ describe('Task Runner', () => { ); expect(logger.debug).nthCalledWith( 4, - 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":0,"numberOfScheduledActions":0,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"active"}' + 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":0,"numberOfGeneratedActions":0,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"active"}' ); const eventLogger = taskRunnerFactoryInitializerParams.eventLogger; @@ -466,7 +466,7 @@ describe('Task Runner', () => { outcome: 'success', status: 'active', numberOfTriggeredActions: 0, - numberOfScheduledActions: 0, + numberOfGeneratedActions: 0, task: true, consumer: 'bar', }) @@ -588,7 +588,7 @@ describe('Task Runner', () => { ); expect(logger.debug).nthCalledWith( 4, - 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":1,"numberOfScheduledActions":1,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"active"}' + 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":1,"numberOfGeneratedActions":1,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"active"}' ); expect(mockUsageCounter.incrementCounter).not.toHaveBeenCalled(); } @@ -777,7 +777,7 @@ describe('Task Runner', () => { outcome: 'success', status: 'active', numberOfTriggeredActions: 0, - numberOfScheduledActions: 0, + numberOfGeneratedActions: 0, task: true, consumer: 'bar', }) @@ -842,7 +842,7 @@ describe('Task Runner', () => { outcome: 'success', status: 'active', numberOfTriggeredActions: 1, - numberOfScheduledActions: 1, + numberOfGeneratedActions: 1, task: true, consumer: 'bar', }) @@ -916,7 +916,7 @@ describe('Task Runner', () => { outcome: 'success', status: 'active', numberOfTriggeredActions: 1, - numberOfScheduledActions: 1, + numberOfGeneratedActions: 1, task: true, consumer: 'bar', }) @@ -1034,7 +1034,7 @@ describe('Task Runner', () => { outcome: 'success', status: 'active', numberOfTriggeredActions: 1, - numberOfScheduledActions: 1, + numberOfGeneratedActions: 1, task: true, consumer: 'bar', }) @@ -1116,7 +1116,7 @@ describe('Task Runner', () => { ); expect(logger.debug).nthCalledWith( 4, - 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":2,"numberOfScheduledActions":2,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"active"}' + 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":2,"numberOfGeneratedActions":2,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"active"}' ); const eventLogger = customTaskRunnerFactoryInitializerParams.eventLogger; @@ -1183,7 +1183,7 @@ describe('Task Runner', () => { outcome: 'success', status: 'active', numberOfTriggeredActions: 2, - numberOfScheduledActions: 2, + numberOfGeneratedActions: 2, task: true, consumer: 'bar', }) @@ -1257,7 +1257,7 @@ describe('Task Runner', () => { ); expect(logger.debug).nthCalledWith( 4, - `ruleExecutionStatus for test:${alertId}: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":2,"numberOfScheduledActions":2,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"active"}` + `ruleExecutionStatus for test:${alertId}: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":2,"numberOfGeneratedActions":2,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"active"}` ); const eventLogger = customTaskRunnerFactoryInitializerParams.eventLogger; @@ -1445,7 +1445,7 @@ describe('Task Runner', () => { outcome: 'success', status: 'active', numberOfTriggeredActions: 0, - numberOfScheduledActions: 2, + numberOfGeneratedActions: 2, task: true, consumer: 'bar', }) @@ -2051,7 +2051,7 @@ describe('Task Runner', () => { outcome: 'success', status: 'active', numberOfTriggeredActions: 0, - numberOfScheduledActions: 0, + numberOfGeneratedActions: 0, task: true, consumer: 'bar', }) @@ -2154,7 +2154,7 @@ describe('Task Runner', () => { outcome: 'success', status: 'active', numberOfTriggeredActions: 0, - numberOfScheduledActions: 0, + numberOfGeneratedActions: 0, task: true, consumer: 'bar', }) @@ -2246,7 +2246,7 @@ describe('Task Runner', () => { status: 'active', consumer: 'bar', numberOfTriggeredActions: 0, - numberOfScheduledActions: 0, + numberOfGeneratedActions: 0, task: true, }) ); @@ -2336,7 +2336,7 @@ describe('Task Runner', () => { status: 'ok', consumer: 'bar', numberOfTriggeredActions: 0, - numberOfScheduledActions: 0, + numberOfGeneratedActions: 0, task: true, }) ); @@ -2422,7 +2422,7 @@ describe('Task Runner', () => { status: 'ok', consumer: 'bar', numberOfTriggeredActions: 0, - numberOfScheduledActions: 0, + numberOfGeneratedActions: 0, task: true, }) ); @@ -2484,7 +2484,7 @@ describe('Task Runner', () => { expect(logger.debug).nthCalledWith(1, 'executing rule test:1 at 1970-01-01T00:00:00.000Z'); expect(logger.debug).nthCalledWith( 2, - 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":0,"numberOfScheduledActions":0,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"ok"}' + 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":0,"numberOfGeneratedActions":0,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"ok"}' ); const eventLogger = taskRunnerFactoryInitializerParams.eventLogger; @@ -2819,7 +2819,7 @@ describe('Task Runner', () => { outcome: 'success', status: 'warning', numberOfTriggeredActions: ruleTypeWithConfig.config.run.actions.max, - numberOfScheduledActions: mockActions.length, + numberOfGeneratedActions: mockActions.length, reason: RuleExecutionStatusWarningReasons.MAX_EXECUTABLE_ACTIONS, task: true, consumer: 'bar', diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner.ts b/x-pack/plugins/alerting/server/task_runner/task_runner.ts index f7317fc5e6b48..36703e7c28dd7 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner.ts @@ -493,7 +493,7 @@ export class TaskRunner< const alertExecutionStore: AlertExecutionStore = { numberOfTriggeredActions: 0, - numberOfScheduledActions: 0, + numberOfGeneratedActions: 0, triggeredActionsStatus: ActionsCompletion.COMPLETE, }; @@ -822,8 +822,8 @@ export class TaskRunner< ); set( event, - 'kibana.alert.rule.execution.metrics.number_of_scheduled_actions', - executionStatus.numberOfScheduledActions + 'kibana.alert.rule.execution.metrics.number_of_generated_actions', + executionStatus.numberOfGeneratedActions ); } diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner_cancel.test.ts b/x-pack/plugins/alerting/server/task_runner/task_runner_cancel.test.ts index 92ef6fcf21ada..66a7b85a94259 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner_cancel.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner_cancel.test.ts @@ -333,7 +333,7 @@ describe('Task Runner Cancel', () => { metrics: { number_of_searches: 3, number_of_triggered_actions: 0, - number_of_scheduled_actions: 0, + number_of_generated_actions: 0, es_search_duration_ms: 33, total_search_duration_ms: 23423, }, @@ -523,7 +523,7 @@ describe('Task Runner Cancel', () => { ); expect(logger.debug).nthCalledWith( 7, - 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":0,"numberOfScheduledActions":0,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"active"}' + 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":0,"numberOfGeneratedActions":0,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"active"}' ); const eventLogger = taskRunnerFactoryInitializerParams.eventLogger; @@ -617,7 +617,7 @@ describe('Task Runner Cancel', () => { metrics: { number_of_searches: 3, number_of_triggered_actions: 0, - number_of_scheduled_actions: 0, + number_of_generated_actions: 0, es_search_duration_ms: 33, total_search_duration_ms: 23423, }, @@ -683,7 +683,7 @@ describe('Task Runner Cancel', () => { ); expect(logger.debug).nthCalledWith( 6, - 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":1,"numberOfScheduledActions":1,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"active"}' + 'ruleExecutionStatus for test:1: {"metrics":{"numSearches":3,"esSearchDurationMs":33,"totalSearchDurationMs":23423},"numberOfTriggeredActions":1,"numberOfGeneratedActions":1,"lastExecutionDate":"1970-01-01T00:00:00.000Z","status":"active"}' ); const eventLogger = taskRunnerFactoryInitializerParams.eventLogger; @@ -896,7 +896,7 @@ describe('Task Runner Cancel', () => { metrics: { number_of_searches: 3, number_of_triggered_actions: 1, - number_of_scheduled_actions: 1, + number_of_generated_actions: 1, es_search_duration_ms: 33, total_search_duration_ms: 23423, }, diff --git a/x-pack/plugins/alerting/server/task_runner/types.ts b/x-pack/plugins/alerting/server/task_runner/types.ts index 4aa104fa05410..735470cf7220b 100644 --- a/x-pack/plugins/alerting/server/task_runner/types.ts +++ b/x-pack/plugins/alerting/server/task_runner/types.ts @@ -163,6 +163,6 @@ export enum ActionsCompletion { export interface AlertExecutionStore { numberOfTriggeredActions: number; - numberOfScheduledActions: number; + numberOfGeneratedActions: number; triggeredActionsStatus: ActionsCompletion; } diff --git a/x-pack/plugins/alerting/server/usage/alerting_telemetry.test.ts b/x-pack/plugins/alerting/server/usage/alerting_telemetry.test.ts index 212731625aa84..e43283e14e822 100644 --- a/x-pack/plugins/alerting/server/usage/alerting_telemetry.test.ts +++ b/x-pack/plugins/alerting/server/usage/alerting_telemetry.test.ts @@ -264,12 +264,12 @@ Object { }, countTotal: 4, countTotalFailures: 4, - scheduledActionsPercentiles: { + generatedActionsPercentiles: { p50: 4, p90: 26, p99: 26, }, - scheduledActionsPercentilesByType: { + generatedActionsPercentilesByType: { p50: { '__index-threshold': 4, logs__alert__document__count: 10, diff --git a/x-pack/plugins/alerting/server/usage/alerting_telemetry.ts b/x-pack/plugins/alerting/server/usage/alerting_telemetry.ts index 7225a0f5f606a..78ec88d959a8b 100644 --- a/x-pack/plugins/alerting/server/usage/alerting_telemetry.ts +++ b/x-pack/plugins/alerting/server/usage/alerting_telemetry.ts @@ -47,9 +47,9 @@ const ruleTypeMetric = { }, }; -const scheduledActionsPercentilesAgg = { +const generatedActionsPercentilesAgg = { percentiles: { - field: 'kibana.alert.rule.execution.metrics.number_of_scheduled_actions', + field: 'kibana.alert.rule.execution.metrics.number_of_generated_actions', percents: [50, 90, 99], }, }; @@ -425,14 +425,14 @@ export async function getExecutionsPerDayCount( avgTotalSearchDuration: { avg: { field: 'kibana.alert.rule.execution.metrics.total_search_duration_ms' }, }, - percentileScheduledActions: scheduledActionsPercentilesAgg, + percentileScheduledActions: generatedActionsPercentilesAgg, aggsByType: { terms: { field: 'rule.category', size: NUM_ALERTING_RULE_TYPES, }, aggs: { - percentileScheduledActions: scheduledActionsPercentilesAgg, + percentileScheduledActions: generatedActionsPercentilesAgg, }, }, }, @@ -465,7 +465,7 @@ export async function getExecutionsPerDayCount( searchResult.aggregations.avgTotalSearchDuration.value ); - const aggsScheduledActionsPercentiles = + const aggsGeneratedActionsPercentiles = // @ts-expect-error aggegation type is not specified searchResult.aggregations.percentileScheduledActions.values; @@ -571,18 +571,18 @@ export async function getExecutionsPerDayCount( }), {} ), - scheduledActionsPercentiles: Object.keys(aggsScheduledActionsPercentiles).reduce( + generatedActionsPercentiles: Object.keys(aggsGeneratedActionsPercentiles).reduce( // ES DSL aggregations are returned as `any` by esClient.search // eslint-disable-next-line @typescript-eslint/no-explicit-any (acc: any, curr: string) => ({ ...acc, ...(percentileFieldNameMapping[curr] - ? { [percentileFieldNameMapping[curr]]: aggsScheduledActionsPercentiles[curr] } + ? { [percentileFieldNameMapping[curr]]: aggsGeneratedActionsPercentiles[curr] } : {}), }), {} ), - scheduledActionsPercentilesByType: parsePercentileAggsByRuleType( + generatedActionsPercentilesByType: parsePercentileAggsByRuleType( aggsByTypeBuckets, 'percentileScheduledActions.values' ), diff --git a/x-pack/plugins/alerting/server/usage/alerting_usage_collector.ts b/x-pack/plugins/alerting/server/usage/alerting_usage_collector.ts index af15846574be8..b80afbc81e77e 100644 --- a/x-pack/plugins/alerting/server/usage/alerting_usage_collector.ts +++ b/x-pack/plugins/alerting/server/usage/alerting_usage_collector.ts @@ -68,14 +68,14 @@ const byReasonSchema: MakeSchemaFrom['count_rules_executions_fail unknown: { type: 'long' }, }; -const byPercentileSchema: MakeSchemaFrom['percentile_num_scheduled_actions_per_day'] = +const byPercentileSchema: MakeSchemaFrom['percentile_num_generated_actions_per_day'] = { p50: { type: 'long' }, p90: { type: 'long' }, p99: { type: 'long' }, }; -const byPercentileSchemaByType: MakeSchemaFrom['percentile_num_scheduled_actions_by_type_per_day'] = +const byPercentileSchemaByType: MakeSchemaFrom['percentile_num_generated_actions_by_type_per_day'] = { p50: byTypeSchema, p90: byTypeSchema, @@ -176,12 +176,12 @@ export function createAlertingUsageCollector( avg_es_search_duration_by_type_per_day: {}, avg_total_search_duration_per_day: 0, avg_total_search_duration_by_type_per_day: {}, - percentile_num_scheduled_actions_per_day: { + percentile_num_generated_actions_per_day: { p50: 0, p90: 0, p99: 0, }, - percentile_num_scheduled_actions_by_type_per_day: { + percentile_num_generated_actions_by_type_per_day: { p50: {}, p90: {}, p99: {}, @@ -237,8 +237,8 @@ export function createAlertingUsageCollector( avg_es_search_duration_by_type_per_day: byTypeSchema, avg_total_search_duration_per_day: { type: 'long' }, avg_total_search_duration_by_type_per_day: byTypeSchema, - percentile_num_scheduled_actions_per_day: byPercentileSchema, - percentile_num_scheduled_actions_by_type_per_day: byPercentileSchemaByType, + percentile_num_generated_actions_per_day: byPercentileSchema, + percentile_num_generated_actions_by_type_per_day: byPercentileSchemaByType, }, }); } diff --git a/x-pack/plugins/alerting/server/usage/task.ts b/x-pack/plugins/alerting/server/usage/task.ts index 512db36f47b2a..cb2f1e7af1f2f 100644 --- a/x-pack/plugins/alerting/server/usage/task.ts +++ b/x-pack/plugins/alerting/server/usage/task.ts @@ -144,10 +144,10 @@ export function telemetryTaskRunner( avg_total_search_duration_per_day: dailyExecutionCounts.avgTotalSearchDuration, avg_total_search_duration_by_type_per_day: dailyExecutionCounts.avgTotalSearchDurationByType, - percentile_num_scheduled_actions_per_day: - dailyExecutionCounts.scheduledActionsPercentiles, - percentile_num_scheduled_actions_by_type_per_day: - dailyExecutionCounts.scheduledActionsPercentilesByType, + percentile_num_generated_actions_per_day: + dailyExecutionCounts.generatedActionsPercentiles, + percentile_num_generated_actions_by_type_per_day: + dailyExecutionCounts.generatedActionsPercentilesByType, }, runAt: getNextMidnight(), }; diff --git a/x-pack/plugins/alerting/server/usage/types.ts b/x-pack/plugins/alerting/server/usage/types.ts index 00bd3b46f91b1..3023d9ab0e13c 100644 --- a/x-pack/plugins/alerting/server/usage/types.ts +++ b/x-pack/plugins/alerting/server/usage/types.ts @@ -25,12 +25,12 @@ export interface AlertingUsage { string, Record >; - percentile_num_scheduled_actions_per_day: { + percentile_num_generated_actions_per_day: { p50: number; p90: number; p99: number; }; - percentile_num_scheduled_actions_by_type_per_day: { + percentile_num_generated_actions_by_type_per_day: { p50: Record; p90: Record; p99: Record; diff --git a/x-pack/plugins/event_log/generated/mappings.json b/x-pack/plugins/event_log/generated/mappings.json index f030f0d50b5e7..982699274e1e3 100644 --- a/x-pack/plugins/event_log/generated/mappings.json +++ b/x-pack/plugins/event_log/generated/mappings.json @@ -296,7 +296,7 @@ "number_of_triggered_actions": { "type": "long" }, - "number_of_scheduled_actions": { + "number_of_generated_actions": { "type": "long" }, "number_of_searches": { @@ -364,4 +364,4 @@ } } } -} \ No newline at end of file +} diff --git a/x-pack/plugins/event_log/generated/schemas.ts b/x-pack/plugins/event_log/generated/schemas.ts index 817c545b45c56..e030a0ce1e99c 100644 --- a/x-pack/plugins/event_log/generated/schemas.ts +++ b/x-pack/plugins/event_log/generated/schemas.ts @@ -130,7 +130,7 @@ export const EventSchema = schema.maybe( metrics: schema.maybe( schema.object({ number_of_triggered_actions: ecsNumber(), - number_of_scheduled_actions: ecsNumber(), + number_of_generated_actions: ecsNumber(), number_of_searches: ecsNumber(), total_indexing_duration_ms: ecsNumber(), es_search_duration_ms: ecsNumber(), diff --git a/x-pack/plugins/event_log/scripts/mappings.js b/x-pack/plugins/event_log/scripts/mappings.js index bf3f9c6b88009..b4bb17eba42a1 100644 --- a/x-pack/plugins/event_log/scripts/mappings.js +++ b/x-pack/plugins/event_log/scripts/mappings.js @@ -78,7 +78,7 @@ exports.EcsCustomPropertyMappings = { number_of_triggered_actions: { type: 'long', }, - number_of_scheduled_actions: { + number_of_generated_actions: { type: 'long', }, number_of_searches: { diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index 7db9d905d5c93..c8cd2b27210ff 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -1944,7 +1944,7 @@ } } }, - "percentile_num_scheduled_actions_per_day": { + "percentile_num_generated_actions_per_day": { "properties": { "p50": { "type": "long" @@ -1957,7 +1957,7 @@ } } }, - "percentile_num_scheduled_actions_by_type_per_day": { + "percentile_num_generated_actions_by_type_per_day": { "properties": { "p50": { "properties": { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/constants/index.ts b/x-pack/plugins/triggers_actions_ui/public/application/constants/index.ts index fda9677d821f8..b0c417e3ef9c9 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/constants/index.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/constants/index.ts @@ -50,7 +50,7 @@ export const RULE_EXECUTION_LOG_COLUMN_IDS = [ 'num_new_alerts', 'num_recovered_alerts', 'num_triggered_actions', - 'num_scheduled_actions', + 'num_generated_actions', 'num_succeeded_actions', 'num_errored_actions', 'total_search_duration', diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list.tsx index 509e30992fd4d..e102affd9af38 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list.tsx @@ -144,14 +144,14 @@ const columns = [ isSortable: getIsColumnSortable('num_triggered_actions'), }, { - id: 'num_scheduled_actions', + id: 'num_generated_actions', displayAsText: i18n.translate( 'xpack.triggersActionsUI.sections.ruleDetails.eventLogColumn.scheduledActions', { - defaultMessage: 'Scheduled actions', + defaultMessage: 'Generated actions', } ), - isSortable: getIsColumnSortable('num_scheduled_actions'), + isSortable: getIsColumnSortable('num_generated_actions'), }, { id: 'num_succeeded_actions', diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/telemetry/alerting_telemetry.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/telemetry/alerting_telemetry.ts index 2773d137f25a4..4a5395b76c694 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/telemetry/alerting_telemetry.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/telemetry/alerting_telemetry.ts @@ -381,66 +381,66 @@ export default function createAlertingTelemetryTests({ getService }: FtrProvider ).to.be.empty(); // percentile calculations for number of scheduled actions - expect(telemetry.percentile_num_scheduled_actions_per_day.p50 >= 0).to.be(true); - expect(telemetry.percentile_num_scheduled_actions_per_day.p90 > 0).to.be(true); - expect(telemetry.percentile_num_scheduled_actions_per_day.p99 > 0).to.be(true); + expect(telemetry.percentile_num_generated_actions_per_day.p50 >= 0).to.be(true); + expect(telemetry.percentile_num_generated_actions_per_day.p90 > 0).to.be(true); + expect(telemetry.percentile_num_generated_actions_per_day.p99 > 0).to.be(true); // percentile calculations by rule type. most of these rule types don't schedule actions so they should all be 0 expect( - telemetry.percentile_num_scheduled_actions_by_type_per_day.p50['example__always-firing'] + telemetry.percentile_num_generated_actions_by_type_per_day.p50['example__always-firing'] ).to.equal(0); expect( - telemetry.percentile_num_scheduled_actions_by_type_per_day.p90['example__always-firing'] + telemetry.percentile_num_generated_actions_by_type_per_day.p90['example__always-firing'] ).to.equal(0); expect( - telemetry.percentile_num_scheduled_actions_by_type_per_day.p99['example__always-firing'] + telemetry.percentile_num_generated_actions_by_type_per_day.p99['example__always-firing'] ).to.equal(0); expect( - telemetry.percentile_num_scheduled_actions_by_type_per_day.p50.test__onlyContextVariables + telemetry.percentile_num_generated_actions_by_type_per_day.p50.test__onlyContextVariables ).to.equal(0); expect( - telemetry.percentile_num_scheduled_actions_by_type_per_day.p90.test__onlyContextVariables + telemetry.percentile_num_generated_actions_by_type_per_day.p90.test__onlyContextVariables ).to.equal(0); expect( - telemetry.percentile_num_scheduled_actions_by_type_per_day.p99.test__onlyContextVariables + telemetry.percentile_num_generated_actions_by_type_per_day.p99.test__onlyContextVariables ).to.equal(0); - expect(telemetry.percentile_num_scheduled_actions_by_type_per_day.p50.test__noop).to.equal(0); - expect(telemetry.percentile_num_scheduled_actions_by_type_per_day.p90.test__noop).to.equal(0); - expect(telemetry.percentile_num_scheduled_actions_by_type_per_day.p99.test__noop).to.equal(0); + expect(telemetry.percentile_num_generated_actions_by_type_per_day.p50.test__noop).to.equal(0); + expect(telemetry.percentile_num_generated_actions_by_type_per_day.p90.test__noop).to.equal(0); + expect(telemetry.percentile_num_generated_actions_by_type_per_day.p99.test__noop).to.equal(0); - expect(telemetry.percentile_num_scheduled_actions_by_type_per_day.p50.test__throw).to.equal( + expect(telemetry.percentile_num_generated_actions_by_type_per_day.p50.test__throw).to.equal( 0 ); - expect(telemetry.percentile_num_scheduled_actions_by_type_per_day.p90.test__throw).to.equal( + expect(telemetry.percentile_num_generated_actions_by_type_per_day.p90.test__throw).to.equal( 0 ); - expect(telemetry.percentile_num_scheduled_actions_by_type_per_day.p99.test__throw).to.equal( + expect(telemetry.percentile_num_generated_actions_by_type_per_day.p99.test__throw).to.equal( 0 ); expect( - telemetry.percentile_num_scheduled_actions_by_type_per_day.p50.test__multipleSearches + telemetry.percentile_num_generated_actions_by_type_per_day.p50.test__multipleSearches ).to.equal(0); expect( - telemetry.percentile_num_scheduled_actions_by_type_per_day.p90.test__multipleSearches + telemetry.percentile_num_generated_actions_by_type_per_day.p90.test__multipleSearches ).to.equal(0); expect( - telemetry.percentile_num_scheduled_actions_by_type_per_day.p99.test__multipleSearches + telemetry.percentile_num_generated_actions_by_type_per_day.p99.test__multipleSearches ).to.equal(0); // this rule type does schedule actions so should be least 1 action scheduled expect( - telemetry.percentile_num_scheduled_actions_by_type_per_day.p50['test__cumulative-firing'] >= + telemetry.percentile_num_generated_actions_by_type_per_day.p50['test__cumulative-firing'] >= 1 ).to.be(true); expect( - telemetry.percentile_num_scheduled_actions_by_type_per_day.p90['test__cumulative-firing'] >= + telemetry.percentile_num_generated_actions_by_type_per_day.p90['test__cumulative-firing'] >= 1 ).to.be(true); expect( - telemetry.percentile_num_scheduled_actions_by_type_per_day.p99['test__cumulative-firing'] >= + telemetry.percentile_num_generated_actions_by_type_per_day.p99['test__cumulative-firing'] >= 1 ).to.be(true); }); diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_execution_log.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_execution_log.ts index 7b4463996edf3..5e9387ad4f0f9 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_execution_log.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_execution_log.ts @@ -94,7 +94,7 @@ export default function createGetExecutionLogTests({ getService }: FtrProviderCo expect(log.num_new_alerts).to.equal(0); expect(log.num_recovered_alerts).to.equal(0); expect(log.num_triggered_actions).to.equal(0); - expect(log.num_scheduled_actions).to.equal(0); + expect(log.num_generated_actions).to.equal(0); expect(log.num_succeeded_actions).to.equal(0); expect(log.num_errored_actions).to.equal(0); @@ -195,7 +195,7 @@ export default function createGetExecutionLogTests({ getService }: FtrProviderCo expect(log.num_new_alerts).to.equal(0); expect(log.num_recovered_alerts).to.equal(0); expect(log.num_triggered_actions).to.equal(0); - expect(log.num_scheduled_actions).to.equal(0); + expect(log.num_generated_actions).to.equal(0); expect(log.num_succeeded_actions).to.equal(0); expect(log.num_errored_actions).to.equal(0); @@ -350,7 +350,7 @@ export default function createGetExecutionLogTests({ getService }: FtrProviderCo expect(log.num_new_alerts).to.equal(1); expect(log.num_recovered_alerts).to.equal(0); expect(log.num_triggered_actions).to.equal(1); - expect(log.num_scheduled_actions).to.equal(1); + expect(log.num_generated_actions).to.equal(1); expect(log.num_succeeded_actions).to.equal(1); expect(log.num_errored_actions).to.equal(0); } @@ -408,7 +408,7 @@ export default function createGetExecutionLogTests({ getService }: FtrProviderCo expect(log.num_new_alerts).to.equal(1); expect(log.num_recovered_alerts).to.equal(0); expect(log.num_triggered_actions).to.equal(1); - expect(log.num_scheduled_actions).to.equal(1); + expect(log.num_generated_actions).to.equal(1); expect(log.num_succeeded_actions).to.equal(0); expect(log.num_errored_actions).to.equal(1); }