Skip to content

Commit

Permalink
Rename the term "execution" in config to "run"
Browse files Browse the repository at this point in the history
  • Loading branch information
ersin-erdal committed Apr 13, 2022
1 parent 62c049b commit a4b0098
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 64 deletions.
8 changes: 4 additions & 4 deletions docs/settings/alert-action-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -198,22 +198,22 @@ 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`::
`xpack.alerting.rules.run.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.
+
For example:
```
xpack.alerting.rules.execution:
xpack.alerting.rules.run:
timeout: '5m'
ruleTypeOverrides:
- id: '.index-threshold'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.execution.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.

Expand Down
10 changes: 5 additions & 5 deletions x-pack/plugins/alerting/server/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
},
}
`);
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/alerting/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
Expand Down
10 changes: 3 additions & 7 deletions x-pack/plugins/alerting/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}),
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ const config = {
value: '2m',
enforce: false,
},
execution: {
run: {
timeout: '1m',
actions: { max: 1000 },
},
} as RulesConfig;

const configWithRuleType = {
...config,
execution: {
...config.execution,
run: {
...config.run,
ruleTypeOverrides: [
{
id: ruleTypeId,
Expand All @@ -35,7 +35,7 @@ const configWithRuleType = {

const configWithoutTimeout = {
...config,
execution: {
run: {
actions: { max: 1000 },
},
};
Expand Down
10 changes: 5 additions & 5 deletions x-pack/plugins/alerting/server/lib/get_rules_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ const config = {
value: '2m',
enforce: false,
},
execution: {
run: {
timeout: '1m',
actions: { max: 1000 },
},
} as RulesConfig;

const configWithRuleType = {
...config,
execution: {
...config.execution,
run: {
...config.run,
ruleTypeOverrides: [
{
id: ruleTypeId,
Expand All @@ -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 },
Expand All @@ -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,
});
});
});
12 changes: 6 additions & 6 deletions x-pack/plugins/alerting/server/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const generateAlertingConfig = (): AlertingConfig => ({
cancelAlertsOnRuleTimeout: true,
rules: {
minimumScheduleInterval: { value: '1m', enforce: false },
execution: {
run: {
actions: {
max: 1000,
},
Expand All @@ -51,7 +51,7 @@ const sampleRuleType: RuleType<never, never, never, never, never, 'default'> = {
defaultActionGroupId: 'default',
producer: 'test',
config: {
execution: {
run: {
actions: {
max: 1000,
},
Expand Down Expand Up @@ -127,7 +127,7 @@ describe('Alerting Plugin', () => {
...generateAlertingConfig(),
rules: {
minimumScheduleInterval: { value: '1m', enforce: false },
execution: {
run: {
actions: {
max: 123,
},
Expand All @@ -142,7 +142,7 @@ describe('Alerting Plugin', () => {
setupContract.registerType(ruleType);

expect(ruleType.config).toEqual({
execution: {
run: {
actions: { max: 123 },
},
});
Expand All @@ -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' }],
},
Expand All @@ -167,7 +167,7 @@ describe('Alerting Plugin', () => {
setupContract.registerType(ruleType);

expect(ruleType.config).toEqual({
execution: {
run: {
id: sampleRuleType.id,
actions: {
max: 123,
Expand Down
36 changes: 18 additions & 18 deletions x-pack/plugins/alerting/server/rule_type_registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand All @@ -87,7 +87,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand Down Expand Up @@ -125,7 +125,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand Down Expand Up @@ -154,7 +154,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand Down Expand Up @@ -186,7 +186,7 @@ describe('Create Lifecycle', () => {
producer: 'alerts',
defaultScheduleInterval: 'foobar',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand Down Expand Up @@ -279,7 +279,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand Down Expand Up @@ -313,7 +313,7 @@ describe('Create Lifecycle', () => {
minimumLicenseRequired: 'basic',
isExportable: true,
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand Down Expand Up @@ -351,7 +351,7 @@ describe('Create Lifecycle', () => {
minimumLicenseRequired: 'basic',
isExportable: true,
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand Down Expand Up @@ -393,7 +393,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand Down Expand Up @@ -424,7 +424,7 @@ describe('Create Lifecycle', () => {
producer: 'alerts',
ruleTaskTimeout: '20m',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand Down Expand Up @@ -461,7 +461,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand Down Expand Up @@ -489,7 +489,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand All @@ -510,7 +510,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand All @@ -537,7 +537,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand All @@ -561,7 +561,7 @@ describe('Create Lifecycle', () => {
"state": Array [],
},
"config": Object {
"execution": Object {
"run": Object {
"actions": Object {
"max": 1000,
},
Expand Down Expand Up @@ -616,7 +616,7 @@ describe('Create Lifecycle', () => {
executor: jest.fn(),
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand Down Expand Up @@ -715,7 +715,7 @@ describe('Create Lifecycle', () => {
minimumLicenseRequired: 'basic',
recoveryActionGroup: { id: 'recovered', name: 'Recovered' },
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand Down Expand Up @@ -753,7 +753,7 @@ function ruleTypeWithVariables<ActionGroupIds extends string>(
async executor() {},
producer: 'alerts',
config: {
execution: {
run: {
actions: { max: 1000 },
},
},
Expand Down
Loading

0 comments on commit a4b0098

Please sign in to comment.