Deprecate usage of ephemeral tasks (#154275)

Resolves https://github.com/elastic/kibana/issues/151457.

In this PR, I'm deprecating ephemeral tasks and their related settings.
The following settings have been deprecated with proper warning
messages:
- `xpack.task_manager.ephemeral_tasks.enabled`
- `xpack.task_manager.ephemeral_tasks.request_capacity`
- `xpack.alerting.maxEphemeralActionsPerAlert`

## To verify

1. Set the following in your `kibana.yml`
```
xpack.task_manager.ephemeral_tasks.enabled: true
xpack.task_manager.ephemeral_tasks.request_capacity: 10
xpack.alerting.maxEphemeralActionsPerAlert: 10
```
2. Start up Kibana
3. Notice the deprecation warnings about these settings appear in the
logs
4. Remove settings from step 1

## Sample warning logs

```
[2023-04-18T09:45:36.731-04:00][WARN ][config.deprecation] Configuring "xpack.alerting.maxEphemeralActionsPerAlert" is deprecated and will be removed in a future version. Remove this setting to increase action execution resiliency.
[2023-04-18T09:45:36.732-04:00][WARN ][config.deprecation] Configuring "xpack.task_manager.ephemeral_tasks.enabled" is deprecated and will be removed in a future version. Remove this setting to increase task execution resiliency.
[2023-04-18T09:45:36.732-04:00][WARN ][config.deprecation] Configuring "xpack.task_manager.ephemeral_tasks.request_capacity" is deprecated and will be removed in a future version. Remove this setting to increase task execution resiliency.
```

### Release notes

The following settings have been deprecated. Remove them to increase
task execution resiliency.
- `xpack.task_manager.ephemeral_tasks.enabled`
- `xpack.task_manager.ephemeral_tasks.request_capacity`
- `xpack.alerting.maxEphemeralActionsPerAlert`

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: lcawl <lcawley@elastic.co>
This commit is contained in:
Mike Côté 2023-04-20 07:14:04 -04:00 committed by GitHub
parent ac581be87d
commit d2c905bef5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 33 deletions

View file

@ -223,6 +223,7 @@ xpack.actions.run:
==== Alerting settings
`xpack.alerting.maxEphemeralActionsPerAlert` {ess-icon}::
deprecated:[8.8.0]
Sets the number of actions that will run ephemerally. To use this, enable
ephemeral tasks in task manager first with
<<task-manager-settings,`xpack.task_manager.ephemeral_tasks.enabled`>>

View file

@ -33,11 +33,13 @@ This flag will enable automatic warn and error logging if task manager self dete
The amount of seconds we allow a task to delay before printing a warning server log. Defaults to 60.
`xpack.task_manager.ephemeral_tasks.enabled`::
deprecated:[8.8.0]
Enables a technical preview feature that executes a limited (and configurable) number of actions in the same task as the alert which triggered them.
These action tasks will reduce the latency of the time it takes an action to run after it's triggered, but are not persisted as SavedObjects.
These non-persisted action tasks have a risk that they won't be run at all if the Kibana instance running them exits unexpectedly. Defaults to false.
`xpack.task_manager.ephemeral_tasks.request_capacity`::
deprecated:[8.8.0]
Sets the size of the ephemeral queue defined above. Defaults to 10.
`xpack.task_manager.event_loop_delay.monitor`::

View file

@ -74,7 +74,7 @@ export const plugin = (initContext: PluginInitializerContext) => new AlertingPlu
export const config: PluginConfigDescriptor<AlertsConfigType> = {
schema: configSchema,
deprecations: ({ renameFromRoot }) => [
deprecations: ({ renameFromRoot, deprecate }) => [
renameFromRoot('xpack.alerts.healthCheck', 'xpack.alerting.healthCheck', { level: 'warning' }),
renameFromRoot(
'xpack.alerts.invalidateApiKeysTask.interval',
@ -89,5 +89,9 @@ export const config: PluginConfigDescriptor<AlertsConfigType> = {
renameFromRoot('xpack.alerting.defaultRuleTaskTimeout', 'xpack.alerting.rules.run.timeout', {
level: 'warning',
}),
deprecate('maxEphemeralActionsPerAlert', 'a future version', {
level: 'warning',
message: `Configuring "xpack.alerting.maxEphemeralActionsPerAlert" is deprecated and will be removed in a future version. Remove this setting to increase action execution resiliency.`,
}),
],
};

View file

@ -50,36 +50,49 @@ export const config: PluginConfigDescriptor<TaskManagerConfig> = {
exposeToUsage: {
max_workers: true,
},
deprecations: () => [
(settings, fromPath, addDeprecation) => {
const taskManager = get(settings, fromPath);
if (taskManager?.index) {
addDeprecation({
level: 'critical',
configPath: `${fromPath}.index`,
documentationUrl: 'https://ela.st/kbn-remove-legacy-multitenancy',
message: `"${fromPath}.index" is deprecated. Multitenancy by changing "kibana.index" will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details`,
correctiveActions: {
manualSteps: [
`If you rely on this setting to achieve multitenancy you should use Spaces, cross-cluster replication, or cross-cluster search instead.`,
`To migrate to Spaces, we encourage using saved object management to export your saved objects from a tenant into the default tenant in a space.`,
],
},
});
}
if (taskManager?.max_workers > MAX_WORKERS_LIMIT) {
addDeprecation({
level: 'critical',
configPath: `${fromPath}.max_workers`,
message: `setting "${fromPath}.max_workers" (${taskManager?.max_workers}) greater than ${MAX_WORKERS_LIMIT} is deprecated.`,
correctiveActions: {
manualSteps: [
`Maximum allowed value of "${fromPath}.max_workers" is ${MAX_WORKERS_LIMIT}.` +
`Replace "${fromPath}.max_workers: ${taskManager?.max_workers}" with (${MAX_WORKERS_LIMIT}).`,
],
},
});
}
},
],
deprecations: ({ deprecate }) => {
return [
deprecate('ephemeral_tasks.enabled', 'a future version', {
level: 'warning',
message: `Configuring "xpack.task_manager.ephemeral_tasks.enabled" is deprecated and will be removed in a future version. Remove this setting to increase task execution resiliency.`,
}),
deprecate('ephemeral_tasks.request_capacity', 'a future version', {
level: 'warning',
message: `Configuring "xpack.task_manager.ephemeral_tasks.request_capacity" is deprecated and will be removed in a future version. Remove this setting to increase task execution resiliency.`,
}),
(settings, fromPath, addDeprecation) => {
const taskManager = get(settings, fromPath);
if (taskManager?.index) {
addDeprecation({
level: 'critical',
configPath: `${fromPath}.index`,
documentationUrl: 'https://ela.st/kbn-remove-legacy-multitenancy',
message: `"${fromPath}.index" is deprecated. Multitenancy by changing "kibana.index" will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details`,
correctiveActions: {
manualSteps: [
`If you rely on this setting to achieve multitenancy you should use Spaces, cross-cluster replication, or cross-cluster search instead.`,
`To migrate to Spaces, we encourage using saved object management to export your saved objects from a tenant into the default tenant in a space.`,
],
},
});
}
},
(settings, fromPath, addDeprecation) => {
const taskManager = get(settings, fromPath);
if (taskManager?.max_workers > MAX_WORKERS_LIMIT) {
addDeprecation({
level: 'critical',
configPath: `${fromPath}.max_workers`,
message: `setting "${fromPath}.max_workers" (${taskManager?.max_workers}) greater than ${MAX_WORKERS_LIMIT} is deprecated.`,
correctiveActions: {
manualSteps: [
`Maximum allowed value of "${fromPath}.max_workers" is ${MAX_WORKERS_LIMIT}.` +
`Replace "${fromPath}.max_workers: ${taskManager?.max_workers}" with (${MAX_WORKERS_LIMIT}).`,
],
},
});
}
},
];
},
};