-
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
[Cases] Case action: Error handling and retries #173012
Merged
Merged
Changes from 82 commits
Commits
Show all changes
83 commits
Select commit
Hold shift + click to select a range
0e1bfb0
Register the case action
cnasikas 4777f9c
Register the cases oracle
cnasikas 65a88fa
[CI] Auto-commit changed files from 'node scripts/check_mappings_upda…
kibanamachine eeb35a6
Calculate the hash of the record ID
cnasikas 649dea9
Merge branch 'register_case_action' of github.com:cnasikas/kibana int…
cnasikas 4491476
Get oracle record
cnasikas f4a81a1
Rename folder
cnasikas 5822d73
Sort grouping definition
cnasikas df77537
Increase counter
cnasikas 9955239
Change grouping to record
cnasikas 58bc3d6
Make the rule ID optional in the key
cnasikas 581819a
Better types
cnasikas 449a1b7
Add version when updating
cnasikas c210a0c
Improve types
cnasikas c802637
Fix tests
cnasikas b249032
Merge branch 'case_action' into register_case_action
cnasikas c120c97
Add model version and improve mapping
cnasikas 043a9fe
Fix tests
cnasikas a9db13f
Fix mapping test
cnasikas 32af9e3
[CI] Auto-commit changed files from 'node scripts/check_mappings_upda…
kibanamachine 90acabf
Merge branch 'case_action' into register_case_action
cnasikas b7605b7
Merge branch 'register_case_action' of github.com:cnasikas/kibana int…
cnasikas 7b27008
Define connector params initial schema
cnasikas 13fd013
Bulk get records
cnasikas 69a8778
Group alerts and bulk get oracle records
cnasikas e5c73a3
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine 1ba6117
Bulk create records
cnasikas bf8a32d
Merge branch 'ca_part_2' of github.com:cnasikas/kibana into ca_part_2
cnasikas c6982a5
Add TODOs
cnasikas f184a08
Move bulkGetOrCreateOracleRecords logic to the connector
cnasikas 40f865e
Generate case ids
cnasikas f70bf1e
Get service with a factory
cnasikas 04805ac
Fix docs
cnasikas a3d47e6
Merge branch 'main' into saf_get_instance
cnasikas 3988644
Merge branch 'saf_get_instance' into ca_part_2
cnasikas af1b8ae
Pass the cases client to the case connector
cnasikas 4c6f5ae
Attach alerts to a case
cnasikas a7f1ba1
Merge branch 'case_action' into register_case_action
cnasikas a283b93
Merge branch 'register_case_action' into ca_part_2
cnasikas 8fd2a84
Merge branch 'case_action' into ca_part_2
cnasikas 13012eb
Merge branch 'case_action' into ca_part_2
cnasikas c8e82e5
Bulk create non existing cases
cnasikas 1ead049
Improve the case request
cnasikas b31c167
Small improvements
cnasikas 2621c7d
Add time window to schema
cnasikas ab42f16
Merge branch 'case_action' into ca_time_window
cnasikas ad14c3f
Merge branch 'case_action' into ca_time_window
cnasikas 5d340aa
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine b20ef53
Upsert oracle records
cnasikas b3806ef
Increase the counter when the time window has passed
cnasikas 27209ac
Merge branch 'case_action' into ca_time_window
cnasikas 346735b
Merge branch 'ca_time_window' of github.com:cnasikas/kibana into ca_t…
cnasikas 7e5989e
Add more tests
cnasikas 2a44c29
Add reopenClosedCases to params
cnasikas 0c0d572
Rename cases client method
cnasikas 432a4dc
Reopen closed cases
cnasikas e5ed0dd
Fix issue with concat
cnasikas 70f153d
Merge branch 'case_action' into ca_reopen_cases
cnasikas 1c9fd6f
Open new cases when the cases are closed
cnasikas a24f562
[CI] Auto-commit changed files from 'node scripts/check_mappings_upda…
kibanamachine 48f107c
Add more tests about the time window validation
cnasikas e545acf
Move handling the time window outside of upserting oracle records
cnasikas 9eca674
Merge branch 'ca_reopen_cases' of github.com:cnasikas/kibana into ca_…
cnasikas b5fecef
Merge branch 'case_action' into ca_time_window
cnasikas 81ab220
Fix bug with Regex
cnasikas 003c285
Merge branch 'ca_time_window' into ca_reopen_cases
cnasikas 1a6636a
Merge branch 'case_action' into ca_reopen_cases
cnasikas d64c6f9
Do not attach alerts to cases that will surpress the limit
cnasikas 22bf49b
Handle errors
cnasikas 6d17751
Move execution to another class
cnasikas 70a3417
Create jitter full backoff
cnasikas 19ffd27
Merge branch 'case_action' into ca_error_handling
cnasikas 9ff2617
Merge branch 'case_action' into ca_error_handling
cnasikas 69e90d6
Add tests for jitter
cnasikas aac09db
Create retry service
cnasikas 3b9c564
Retry the execution of the connector
cnasikas 8af3c0f
Add retry tests
cnasikas f214254
Move mock data to the mock file
cnasikas 96afd98
Create test helpers
cnasikas cae023b
Merge branch 'case_action' into ca_error_handling
cnasikas a901029
Remove formatting in current_fields
cnasikas 00a2871
Small improvements
cnasikas 068678a
PR feedback
cnasikas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
932 changes: 134 additions & 798 deletions
932
x-pack/plugins/cases/server/connectors/cases/cases_connector.test.ts
Large diffs are not rendered by default.
Oops, something went wrong.
586 changes: 34 additions & 552 deletions
586
x-pack/plugins/cases/server/connectors/cases/cases_connector.ts
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All logic of the executor moved to |
Large diffs are not rendered by default.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
x-pack/plugins/cases/server/connectors/cases/cases_connector_error.ts
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,24 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { CaseError } from '../../common/error'; | ||
|
||
export class CasesConnectorError extends Error { | ||
public readonly statusCode: number; | ||
|
||
constructor(message: string, statusCode: number) { | ||
super(message); | ||
|
||
this.statusCode = statusCode; | ||
} | ||
} | ||
|
||
export const isCasesConnectorError = (error: unknown): error is CasesConnectorError => | ||
error instanceof CasesConnectorError; | ||
|
||
export const isCasesClientError = (error: unknown): error is CaseError => | ||
error instanceof CaseError; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The test tests only how the executor is called and the retry logic. All the executor logic moved to
cases_connector_executor.test.ts
.