forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reschedule a rule task when there is a cluster_block_exception (elast…
…ic#201761) Resolves: elastic/response-ops-team#249 This PR reschedules a rule (its task behind it) to be executed again in 1m in case of `cluster_block_exception` that will be thrown during a reindex. ## To verify: - Run your local Kibana, - Create a user with `kibana_system` and `kibana_admin` roles - Logout and login with your new user - Create an Always firing rule with 5m interval - Use below request to put a write block on the index used by the Always firing rule. `PUT /.internal.alerts-default.alerts-default-000001/_block/write` - There shouldn't be any error on the terminal - Check the task SO of the rule by using the below query, value of the `task.schedule.interval` should be 1m and the value of the `task.state` should remain the same. - Use below request on the Kibana console to remove write block. Every thing should come back to normal and alerts of the rule should be saved under `.internal.alerts-default.alerts-default-000001` index. ``` PUT /.kibana_task_manager_9.0.0_001/_settings { "index": { "blocks.write": false } } ``` --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
e4b4101
commit 99b2550
Showing
5 changed files
with
140 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
export const CLUSTER_BLOCK_EXCEPTION = 'cluster_block_exception'; | ||
|
||
export class ErrorWithType extends Error { | ||
public readonly type: string; | ||
|
||
constructor({ | ||
type, | ||
message = 'Unknown error', | ||
stack, | ||
}: { | ||
type: string; | ||
message?: string; | ||
stack?: string; | ||
}) { | ||
super(message); | ||
this.type = type; | ||
this.stack = stack; | ||
} | ||
} | ||
|
||
export function getErrorType(error: Error): string | undefined { | ||
if (isErrorWithType(error)) { | ||
return error.type; | ||
} | ||
} | ||
|
||
export function isErrorWithType(error: Error | ErrorWithType): error is ErrorWithType { | ||
return error instanceof ErrorWithType; | ||
} | ||
|
||
export function isClusterBlockError(err: Error) { | ||
return getErrorType(err) === CLUSTER_BLOCK_EXCEPTION; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters