You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exclude unrecognized tasks from the task manager aggregate API (elastic#202163)
In this PR, I'm removing tasks with a status `unrecognized` from
returning on any `taskStore.aggregate` calls. Without this, we had
unrecognized recurring tasks that were still part of the task manager
capacity calculation under
`assumedAverageRecurringRequiredThroughputPerMinutePerKibana`.
## To Verify
1. Create a few ES Query alerting rules running every 1s
2. Capture the task manager health API report via
`/api/task_manager/_health`
3. Apply the following diff to mark es query alerting tasks as
unrecognized
```
diff --git a/x-pack/plugins/stack_alerts/server/rule_types/es_query/index.ts b/x-pack/plugins/stack_alerts/server/rule_types/es_query/index.ts
index 1988eeb..8d649f4c6a5 100644
--- a/x-pack/plugins/stack_alerts/server/rule_types/es_query/index.ts
+++ b/x-pack/plugins/stack_alerts/server/rule_types/es_query/index.ts
@@ -10,5 +10,5 @@ import { getRuleType } from './rule_type';
export function register(params: RegisterRuleTypesParams, isServerless: boolean) {
const { alerting, core } = params;
- alerting.registerType(getRuleType(core, isServerless));
+ // alerting.registerType(getRuleType(core, isServerless));
}
diff --git a/x-pack/plugins/task_manager/server/removed_tasks/mark_removed_tasks_as_unrecognized.ts b/x-pack/plugins/task_manager/server/removed_tasks/mark_removed_tasks_as_unrecognized.ts
index e28d522..dbfc1bbd135 100644
--- a/x-pack/plugins/task_manager/server/removed_tasks/mark_removed_tasks_as_unrecognized.ts
+++ b/x-pack/plugins/task_manager/server/removed_tasks/mark_removed_tasks_as_unrecognized.ts
@@ -33,6 +33,11 @@ export async function scheduleMarkRemovedTasksAsUnrecognizedDefinition(
state: {},
params: {},
});
+ try {
+ await taskScheduling.runSoon(TASK_ID);
+ } catch (e) {
+ // Ignore
+ }
} catch (e) {
logger.error(`Error scheduling ${TASK_ID} task, received ${e.message}`);
}
diff --git a/x-pack/plugins/task_manager/server/task_type_dictionary.ts b/x-pack/plugins/task_manager/server/task_type_dictionary.ts
index e0b28ec..142c07bb507 100644
--- a/x-pack/plugins/task_manager/server/task_type_dictionary.ts
+++ b/x-pack/plugins/task_manager/server/task_type_dictionary.ts
@@ -32,6 +32,8 @@ export const REMOVED_TYPES: string[] = [
'cleanup_failed_action_executions',
'reports:monitor',
+
+ 'alerting:.es-query',
];
/**
```
5. Capture the task manager health API report again via
`/api/task_manager/_health`
6. Notice the number dropped for
`capacity_estimation.value.observed.avg_recurring_required_throughput_per_minute`
0 commit comments