Rename the term "execution" in config to "run" (#130172)

* Rename the term "execution" in config to "run"

* Rename the term "execution" in config to "run"

* Rename the overlooked terms

* [DOCS] Fix example indentation

* Update docs/user/alerting/troubleshooting/alerting-common-issues.asciidoc

Co-authored-by: Lisa Cawley <lcawley@elastic.co>

Co-authored-by: lcawl <lcawley@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Ersin Erdal 2022-04-18 18:44:50 +02:00 committed by GitHub
parent a14bcaa0e9
commit f962ff282f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 69 additions and 74 deletions

View file

@ -198,24 +198,26 @@ For example, `20m`, `24h`, `7d`. Default: `1m`.
`xpack.alerting.rules.minimumScheduleInterval.enforce`::
Specifies the behavior when a new or changed rule has a schedule interval less than the value defined in `xpack.alerting.rules.minimumScheduleInterval.value`. If `false`, rules with schedules less than the interval will be created but warnings will be logged. If `true`, rules with schedules less than the interval cannot be created. Default: `false`.
`xpack.alerting.rules.execution.actions.max`::
`xpack.alerting.rules.run.actions.max`::
Specifies the maximum number of actions that a rule can trigger each time detection checks run.
`xpack.alerting.rules.execution.timeout`::
`xpack.alerting.rules.run.timeout`::
Specifies the default timeout for tasks associated with all types of rules. The time is formatted as:
+
`<count>[ms,s,m,h,d,w,M,Y]`
+
For example, `20m`, `24h`, `7d`, `1w`. Default: `5m`.
`xpack.alerting.rules.execution.ruleTypeOverrides`::
Overrides the configs under `xpack.alerting.rules.execution` for the rule type with the given ID. List the rule identifier and its settings in an array of objects.
`xpack.alerting.rules.run.ruleTypeOverrides`::
Overrides the configs under `xpack.alerting.rules.run` for the rule type with the given ID. List the rule identifier and its settings in an array of objects.
+
--
For example:
```
xpack.alerting.rules.execution:
xpack.alerting.rules.run:
timeout: '5m'
ruleTypeOverrides:
- id: '.index-threshold'
timeout: '15m'
```
```
--

View file

@ -85,7 +85,7 @@ and in the <<rule-details,details page>>:
[role="screenshot"]
image::images/rule-details-timeout-error.png[Rule details page with timeout error]
If you want your rules to run longer, update the `xpack.alerting.rules.execution.timeout` configuration in your <<alert-settings>>. You can also target a specific rule type by using `xpack.alerting.rules.execution.ruleTypeOverrides`.
If you want your rules to run longer, update the `xpack.alerting.rules.run.timeout` configuration in your <<alert-settings>>. You can also target a specific rule type by using `xpack.alerting.rules.run.ruleTypeOverrides`.
Rules that consistently run longer than their <<create-edit-rules, check interval>> may produce unexpected results. If the average run duration, visible on the <<rule-details,details page>>, is greater than the check interval, consider increasing the check interval.

View file

@ -22,15 +22,15 @@ describe('config validation', () => {
},
"maxEphemeralActionsPerAlert": 10,
"rules": Object {
"execution": Object {
"actions": Object {
"max": 100000,
},
},
"minimumScheduleInterval": Object {
"enforce": false,
"value": "1m",
},
"run": Object {
"actions": Object {
"max": 100000,
},
},
},
}
`);

View file

@ -21,7 +21,7 @@ const rulesSchema = schema.object({
}),
enforce: schema.boolean({ defaultValue: false }), // if enforce is false, only warnings will be shown
}),
execution: schema.object({
run: schema.object({
timeout: schema.maybe(schema.string({ validate: validateDurationSchema })),
actions: schema.object({
max: schema.number({ defaultValue: 100000 }),

View file

@ -60,12 +60,8 @@ export const config: PluginConfigDescriptor<AlertsConfigType> = {
'xpack.alerting.invalidateApiKeysTask.removalDelay',
{ level: 'warning' }
),
renameFromRoot(
'xpack.alerting.defaultRuleTaskTimeout',
'xpack.alerting.rules.execution.timeout',
{
level: 'warning',
}
),
renameFromRoot('xpack.alerting.defaultRuleTaskTimeout', 'xpack.alerting.rules.run.timeout', {
level: 'warning',
}),
],
};

View file

@ -14,7 +14,7 @@ const config = {
value: '2m',
enforce: false,
},
execution: {
run: {
timeout: '1m',
actions: { max: 1000 },
},
@ -22,8 +22,8 @@ const config = {
const configWithRuleType = {
...config,
execution: {
...config.execution,
run: {
...config.run,
ruleTypeOverrides: [
{
id: ruleTypeId,
@ -35,7 +35,7 @@ const configWithRuleType = {
const configWithoutTimeout = {
...config,
execution: {
run: {
actions: { max: 1000 },
},
};

View file

@ -18,7 +18,7 @@ export const getRuleTaskTimeout = ({
ruleTaskTimeout?: string;
ruleTypeId: string;
}): string => {
const ruleTypeConfig = config.execution.ruleTypeOverrides?.find(
const ruleTypeConfig = config.run.ruleTypeOverrides?.find(
(ruleType) => ruleTypeId === ruleType.id
);
@ -27,9 +27,6 @@ export const getRuleTaskTimeout = ({
// if not, ruleTaskTimeout is applied that is passed from the rule type registering plugin
// if none of above is set, DEFAULT_EXECUTION_TIMEOUT is applied
return (
ruleTypeConfig?.timeout ||
config.execution.timeout ||
ruleTaskTimeout ||
DEFAULT_EXECUTION_TIMEOUT
ruleTypeConfig?.timeout || config.run.timeout || ruleTaskTimeout || DEFAULT_EXECUTION_TIMEOUT
);
};

View file

@ -14,7 +14,7 @@ const config = {
value: '2m',
enforce: false,
},
execution: {
run: {
timeout: '1m',
actions: { max: 1000 },
},
@ -22,8 +22,8 @@ const config = {
const configWithRuleType = {
...config,
execution: {
...config.execution,
run: {
...config.run,
ruleTypeOverrides: [
{
id: ruleTypeId,
@ -36,7 +36,7 @@ const configWithRuleType = {
describe('get rules config', () => {
test('returns the rule type specific config and keeps the default values that are not overwritten', () => {
expect(getExecutionConfigForRuleType({ config: configWithRuleType, ruleTypeId })).toEqual({
execution: {
run: {
id: ruleTypeId,
timeout: '1m',
actions: { max: 20 },
@ -46,7 +46,7 @@ describe('get rules config', () => {
test('returns the default config when there is no rule type specific config', () => {
expect(getExecutionConfigForRuleType({ config, ruleTypeId })).toEqual({
execution: config.execution,
run: config.run,
});
});
});

View file

@ -15,13 +15,13 @@ export const getExecutionConfigForRuleType = ({
config: RulesConfig;
ruleTypeId: string;
}): RuleTypeConfig => {
const ruleTypeExecutionConfig = config.execution.ruleTypeOverrides?.find(
const ruleTypeExecutionConfig = config.run.ruleTypeOverrides?.find(
(ruleType) => ruleType.id === ruleTypeId
);
return {
execution: {
...omit(config.execution, 'ruleTypeOverrides'),
run: {
...omit(config.run, 'ruleTypeOverrides'),
...ruleTypeExecutionConfig,
},
};

View file

@ -34,7 +34,7 @@ const generateAlertingConfig = (): AlertingConfig => ({
cancelAlertsOnRuleTimeout: true,
rules: {
minimumScheduleInterval: { value: '1m', enforce: false },
execution: {
run: {
actions: {
max: 1000,
},
@ -51,7 +51,7 @@ const sampleRuleType: RuleType<never, never, never, never, never, 'default'> = {
defaultActionGroupId: 'default',
producer: 'test',
config: {
execution: {
run: {
actions: {
max: 1000,
},
@ -127,7 +127,7 @@ describe('Alerting Plugin', () => {
...generateAlertingConfig(),
rules: {
minimumScheduleInterval: { value: '1m', enforce: false },
execution: {
run: {
actions: {
max: 123,
},
@ -142,7 +142,7 @@ describe('Alerting Plugin', () => {
setupContract.registerType(ruleType);
expect(ruleType.config).toEqual({
execution: {
run: {
actions: { max: 123 },
},
});
@ -153,7 +153,7 @@ describe('Alerting Plugin', () => {
...generateAlertingConfig(),
rules: {
minimumScheduleInterval: { value: '1m', enforce: false },
execution: {
run: {
actions: { max: 123 },
ruleTypeOverrides: [{ id: sampleRuleType.id, timeout: '1d' }],
},
@ -167,7 +167,7 @@ describe('Alerting Plugin', () => {
setupContract.registerType(ruleType);
expect(ruleType.config).toEqual({
execution: {
run: {
id: sampleRuleType.id,
actions: {
max: 123,

View file

@ -61,7 +61,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -87,7 +87,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -125,7 +125,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -154,7 +154,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -186,7 +186,7 @@ describe('Create Lifecycle', () => {
producer: 'alerts',
defaultScheduleInterval: 'foobar',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -279,7 +279,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -313,7 +313,7 @@ describe('Create Lifecycle', () => {
minimumLicenseRequired: 'basic',
isExportable: true,
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -351,7 +351,7 @@ describe('Create Lifecycle', () => {
minimumLicenseRequired: 'basic',
isExportable: true,
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -393,7 +393,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -424,7 +424,7 @@ describe('Create Lifecycle', () => {
producer: 'alerts',
ruleTaskTimeout: '20m',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -461,7 +461,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -489,7 +489,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -510,7 +510,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -537,7 +537,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -561,7 +561,7 @@ describe('Create Lifecycle', () => {
"state": Array [],
},
"config": Object {
"execution": Object {
"run": Object {
"actions": Object {
"max": 1000,
},
@ -616,7 +616,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -715,7 +715,7 @@ describe('Create Lifecycle', () => {
minimumLicenseRequired: 'basic',
recoveryActionGroup: { id: 'recovered', name: 'Recovered' },
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -753,7 +753,7 @@ function ruleTypeWithVariables<ActionGroupIds extends string>(
async executor() {},
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},

View file

@ -1167,7 +1167,7 @@ describe('create()', () => {
injectReferences: injectReferencesFn,
},
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -1340,7 +1340,7 @@ describe('create()', () => {
injectReferences: injectReferencesFn,
},
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -2099,7 +2099,7 @@ describe('create()', () => {
async executor() {},
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -2629,7 +2629,7 @@ describe('create()', () => {
injectReferences: jest.fn(),
},
config: {
execution: {
run: {
actions: { max: 1000 },
},
},

View file

@ -92,7 +92,7 @@ export function getBeforeSetup(
async executor() {},
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},

View file

@ -49,7 +49,7 @@ const ruleType: NormalizedRuleType<
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
@ -476,7 +476,7 @@ describe('Create Execution Handler', () => {
ruleType: {
...ruleType,
config: {
execution: {
run: {
actions: { max: 2 },
},
},

View file

@ -115,7 +115,7 @@ export function createExecutionHandler<
let ephemeralActionsToSchedule = maxEphemeralActionsPerRule;
for (const action of actions) {
if (alertExecutionStore.numberOfTriggeredActions >= ruleType.config!.execution.actions.max) {
if (alertExecutionStore.numberOfTriggeredActions >= ruleType.config!.run.actions.max) {
alertExecutionStore.triggeredActionsStatus = ActionsCompletion.PARTIAL;
break;
}

View file

@ -109,7 +109,7 @@ export const ruleType: jest.Mocked<UntypedNormalizedRuleType> = {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},

View file

@ -2645,7 +2645,7 @@ describe('Task Runner', () => {
const ruleTypeWithConfig = {
...ruleType,
config: {
execution: {
run: {
actions: { max: 3 },
},
},
@ -2718,7 +2718,7 @@ describe('Task Runner', () => {
const runnerResult = await taskRunner.run();
expect(actionsClient.enqueueExecution).toHaveBeenCalledTimes(
ruleTypeWithConfig.config.execution.actions.max
ruleTypeWithConfig.config.run.actions.max
);
expect(
@ -2818,7 +2818,7 @@ describe('Task Runner', () => {
action: EVENT_LOG_ACTIONS.execute,
outcome: 'success',
status: 'warning',
numberOfTriggeredActions: ruleTypeWithConfig.config.execution.actions.max,
numberOfTriggeredActions: ruleTypeWithConfig.config.run.actions.max,
numberOfScheduledActions: mockActions.length,
reason: RuleExecutionStatusWarningReasons.MAX_EXECUTABLE_ACTIONS,
task: true,

View file

@ -58,7 +58,7 @@ const ruleType: jest.Mocked<UntypedNormalizedRuleType> = {
cancelAlertsOnRuleTimeout: true,
ruleTaskTimeout: '5m',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},