Skip to content

Commit

Permalink
Add getPersistentAlerts to AlertsClient and remove getSummarizedAlert…
Browse files Browse the repository at this point in the history
…s from ruleTypes (elastic#161061)

Resolves: elastic#160176

This PR intends to move the getting alert-as-data fetching logic from
ruleRegistry to alerting framework.
`getPersistentAlerts` method fetches the alerts-as-data as long as the
ruleType has `alerts` settings (fields, formatAlert etc.)

## To verify:
All the rules that use alert-as-data should be still working as they
are.
  • Loading branch information
ersin-erdal authored Aug 1, 2023
1 parent b1ab844 commit 6d9bb6e
Show file tree
Hide file tree
Showing 54 changed files with 1,503 additions and 4,160 deletions.
1 change: 0 additions & 1 deletion x-pack/plugins/alerting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ The following table describes the properties of the `options` object.
|isExportable|Whether the rule type is exportable from the Saved Objects Management UI.|boolean|
|defaultScheduleInterval|(Optional) The default interval that will show up in the UI when creating a rule of this rule type.|boolean|
|doesSetRecoveryContext|(Optional) Whether the rule type will set context variables for recovered alerts. Defaults to `false`. If this is set to true, context variables are made available for the recovery action group and executors will be provided with the ability to set recovery context.|boolean|
|getSummarizedAlerts|(Optional) When developing a rule type, you can choose to implement this hook for retrieving summarized alerts based on execution UUID or time range. This hook will be invoked when an alert summary action is configured for the rule.|Function|
|alerts|(Optional) Specify options for writing alerts as data documents for this rule type. This feature is currently under development so this field is optional but we will eventually make this a requirement of all rule types. For full details, see the alerts as data section below.|IRuleTypeAlerts|
|autoRecoverAlerts|(Optional) Whether the framework should determine if alerts have recovered between rule runs. If not specified, the default value of `true` is used. |boolean|
|getViewInAppRelativeUrl|(Optional) When developing a rule type, you can choose to implement this hook for generating a link back to the Kibana application that can be used in alert actions. If not specified, a generic link back to the Rule Management app is generated.|Function|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const createAlertsClientMock = () => {
hasReachedAlertLimit: jest.fn(),
checkLimitUsage: jest.fn(),
persistAlerts: jest.fn(),
getSummarizedAlerts: jest.fn(),
factory: jest.fn(),
client: jest.fn(),
};
Expand Down
Loading

0 comments on commit 6d9bb6e

Please sign in to comment.