Skip to content

Commit

Permalink
Aligns Alerting's interval with TaskManager's generic schedule field (e…
Browse files Browse the repository at this point in the history
…lastic#52873) (elastic#53515)

Follow up from the elastic#52727 in Task Manager, we want Alerting and Task Manager to align on their schedule api (in the near future, Alerting will actually use Task manager's schedule system to remove this duplication).
  • Loading branch information
gmmorris authored and mikecote committed Dec 18, 2019
1 parent 76aba7d commit 1b6a87b
Show file tree
Hide file tree
Showing 30 changed files with 212 additions and 126 deletions.
12 changes: 10 additions & 2 deletions x-pack/legacy/plugins/alerting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ Payload:
|name|A name to reference and search in the future.|string|
|tags|A list of keywords to reference and search in the future.|string[]|
|alertTypeId|The id value of the alert type you want to call when the alert is scheduled to execute.|string|
|interval|The interval in seconds, minutes, hours or days the alert should execute. Example: `10s`, `5m`, `1h`, `1d`.|string|
|schedule|The schedule specifying when this alert should run, using one of the available schedule formats specified under _Schedule Formats_ below|object|
|params|The parameters to pass in to the alert type executor `params` value. This will also validate against the alert type params validator if defined.|object|
|actions|Array of the following:<br> - `group` (string): We support grouping actions in the scenario of escalations or different types of alert instances. If you don't need this, feel free to use `default` as a value.<br>- `id` (string): The id of the action saved object to execute.<br>- `params` (object): The map to the `params` the action type will receive. In order to help apply context to strings, we handle them as mustache templates and pass in a default set of context. (see templating actions).|array|

Expand Down Expand Up @@ -242,7 +242,7 @@ Payload:

|Property|Description|Type|
|---|---|---|
|interval|The interval in seconds, minutes, hours or days the alert should execute. Example: `10s`, `5m`, `1h`, `1d`.|string|
|schedule|The schedule specifying when this alert should be run, using one of the available schedule formats specified under _Schedule Formats_ below|object|
|name|A name to reference and search in the future.|string|
|tags|A list of keywords to reference and search in the future.|string[]|
|params|The parameters to pass in to the alert type executor `params` value. This will also validate against the alert type params validator if defined.|object|
Expand Down Expand Up @@ -304,6 +304,14 @@ Params:
|---|---|---|
|id|The id of the alert you're trying to update the API key for. System will use user in request context to generate an API key for.|string|

##### Schedule Formats
A schedule is structured such that the key specifies the format you wish to use and its value specifies the schedule.

We currently support the _Interval format_ which specifies the interval in seconds, minutes, hours or days at which the alert should execute.
Example: `{ interval: "10s" }`, `{ interval: "5m" }`, `{ interval: "1h" }`, `{ interval: "1d" }`.

There are plans to support multiple other schedule formats in the near fuiture.

## Alert instance factory

**alertInstanceFactory(id)**
Expand Down
8 changes: 6 additions & 2 deletions x-pack/legacy/plugins/alerting/mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
"alertTypeId": {
"type": "keyword"
},
"interval": {
"type": "keyword"
"schedule": {
"properties": {
"interval": {
"type": "keyword"
}
}
},
"actions": {
"type": "nested",
Expand Down
Loading

0 comments on commit 1b6a87b

Please sign in to comment.