-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Task Manager] Adding list of explicitly de-registered task types #123963
[Task Manager] Adding list of explicitly de-registered task types #123963
Conversation
…nager/unregistered-task-types
…nager/unregistered-task-types
@elasticmachine merge upstream |
@elasticmachine merge upstream |
Pinging @elastic/response-ops (Team:ResponseOps) |
*/ | ||
export const REMOVED_TYPES: string[] = [ | ||
// for testing | ||
'sampleTaskRemovedType', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once this PR is merged will we not actually have any type in here?
It raises the question of whether we need the unusedTypes feature at all, no? 🤔
This reminds me of an issue I forgot to open up, when looking to disable apm telemetry. I believe when I looked into this, if apm was configured to disable telemetry, the existing telemetry task would eventually get marked as Start here, where the kibana/x-pack/plugins/apm/server/plugin.ts Lines 67 to 94 in 8e8c4b8
The actual task registration is in that kibana/x-pack/plugins/apm/server/lib/apm_telemetry/index.ts Lines 37 to 64 in 8e8c4b8
It wouldn't surprise me to find other task registrations that are conditional like this. Again, I >think< with the change in this PR, such tasks would be ignored, until Kibana was later restarted and when down a conditional path to register the task again. And wouldn't end up in the |
….com/ymao1/kibana into task-manager/unregistered-task-types
@pmuellr Yes, that's correct. With the change in this PR, those tasks would not get marked as |
@@ -126,7 +127,7 @@ if (doc['task.runAt'].size()!=0) { | |||
ctx._source.task.status = "claiming"; ${Object.keys(fieldUpdates) | |||
.map((field) => `ctx._source.task.${field}=params.fieldUpdates.${field};`) | |||
.join(' ')} | |||
} else if (!params.skippedTaskTypes.contains(ctx._source.task.taskType)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to test the skipped tasks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously we maintained a list of claimableTaskTypes
and skippedTaskTypes
. These are all the types that this task manager knows about so if a task is not claimable or skipped, we mark is as unrecognized
. Now we are just using claimableTaskTypes
to claim and unusedTaskTypes
to determine what to mark as unrecognized
. Skipped task types will go into the else
bucket and get a no-op
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM, tested locally the following scenarios:
- Alerting rule with a task in "unrecognized" status returning to idle after upgrade
- Alerting rule with a task definition missing did not make the task have an
unrecognized
status - Alerting rule with a task definition missing and part of
REMOVED_TYPES
caused the task status to becomeunrecognized
👍
@elasticmachine merge upstream |
updateFieldsAndMarkAsFailed(fieldUpdates, claimTasksById, ['foo', 'bar'], [], { | ||
foo: 5, | ||
bar: 2, | ||
updateFieldsAndMarkAsFailed({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean Code, group the arguments, love it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@elasticmachine merge upstream |
'sampleTaskRemovedType', | ||
|
||
// deprecated in https://github.com/elastic/kibana/pull/121442 | ||
'alerting:siem.signals', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tagging you on this PR for awareness. We adding an explicit registry of removed task types that will be marked as unrecognized
. Adding alerting:siem.signals
due to this PR that removed that rule type. There should be no change to the outcome of that PR (meaning old siem.signals
rule types will still be marked as unrecognized
)
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @ymao1 |
Resolves #122389
Summary
Adds a list of explicitly de-registered task types and updates claim script to only mark a task as
unrecognized
if the task type exists in that list.In order to explicitly stop registering a task, plugin authors will need to remove the task registration code as well as add the task type to the
REMOVED_TYPES
list inx-pack/plugins/task_manager/server/task_type_dictionary.ts
REMOVED_TYPES
, it will not be marked asunrecognized
. It will just not be claimed.REMOVED_TYPES
but still registered, an error will be thrown. These scenarios should be caught in development.Todo
To Verify
People in Space
rule). Query for the rule in the task manager index and see that status is eitheridle
orrunning
.idle
unrecognized
.Checklist