Skip to content

Commit

Permalink
Rename "scheduled actions" to "generated actions" (elastic#130315)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
2 people authored and kertal committed May 24, 2022
1 parent 61f2da7 commit 9413869
Show file tree
Hide file tree
Showing 30 changed files with 142 additions and 142 deletions.
4 changes: 2 additions & 2 deletions x-pack/plugins/alerting/common/execution_log_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/alerting/common/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export enum RuleExecutionStatusWarningReasons {
export interface RuleExecutionStatus {
status: RuleExecutionStatuses;
numberOfTriggeredActions?: number;
numberOfScheduledActions?: number;
numberOfGeneratedActions?: number;
metrics?: RuleExecutionMetrics;
lastExecutionDate: Date;
lastDuration?: number;
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/alerting/common/rule_task_instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const ruleExecutionMetricsSchema = t.partial({

const alertExecutionStore = t.partial({
numberOfTriggeredActions: t.number,
numberOfScheduledActions: t.number,
numberOfGeneratedActions: t.number,
triggeredActionsStatus: t.string,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]"`
);
});

Expand All @@ -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]"`
);
});

Expand Down Expand Up @@ -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' } },
Expand Down Expand Up @@ -298,7 +298,7 @@ describe('formatExecutionLogResult', () => {
numTriggeredActions: {
value: 5.0,
},
numScheduledActions: {
numGeneratedActions: {
value: 5.0,
},
outcomeAndMessage: {
Expand Down Expand Up @@ -383,7 +383,7 @@ describe('formatExecutionLogResult', () => {
numTriggeredActions: {
value: 5.0,
},
numScheduledActions: {
numGeneratedActions: {
value: 5.0,
},
outcomeAndMessage: {
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -532,7 +532,7 @@ describe('formatExecutionLogResult', () => {
numTriggeredActions: {
value: 5.0,
},
numScheduledActions: {
numGeneratedActions: {
value: 5.0,
},
outcomeAndMessage: {
Expand Down Expand Up @@ -620,7 +620,7 @@ describe('formatExecutionLogResult', () => {
numTriggeredActions: {
value: 5.0,
},
numScheduledActions: {
numGeneratedActions: {
value: 5.0,
},
outcomeAndMessage: {
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -769,7 +769,7 @@ describe('formatExecutionLogResult', () => {
numTriggeredActions: {
value: 0.0,
},
numScheduledActions: {
numGeneratedActions: {
value: 0.0,
},
outcomeAndMessage: {
Expand Down Expand Up @@ -849,7 +849,7 @@ describe('formatExecutionLogResult', () => {
numTriggeredActions: {
value: 5.0,
},
numScheduledActions: {
numGeneratedActions: {
value: 5.0,
},
outcomeAndMessage: {
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -998,7 +998,7 @@ describe('formatExecutionLogResult', () => {
numTriggeredActions: {
value: 5.0,
},
numScheduledActions: {
numGeneratedActions: {
value: 5.0,
},
outcomeAndMessage: {
Expand Down Expand Up @@ -1083,7 +1083,7 @@ describe('formatExecutionLogResult', () => {
numTriggeredActions: {
value: 5.0,
},
numScheduledActions: {
numGeneratedActions: {
value: 5.0,
},
outcomeAndMessage: {
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -90,7 +90,7 @@ const ExecutionLogSortFields: Record<string, string> = {
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) {
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions x-pack/plugins/alerting/server/lib/rule_execution_status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -88,15 +88,15 @@ describe('RuleExecutionStatus', () => {
const status = executionStatusFromState({
alertExecutionStore: {
numberOfTriggeredActions: 1,
numberOfScheduledActions: 2,
numberOfGeneratedActions: 2,
triggeredActionsStatus: ActionsCompletion.COMPLETE,
},
alertInstances: { a: {} },
metrics,
});
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 && {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down
Loading

0 comments on commit 9413869

Please sign in to comment.