🔎 Open source distributed and RESTful search engine.
Go to file
uboness a632d57803 Introducing the `Trigger` notion
Today every `watch` is associated with a `schedule`. When the watch is added to the system, its schedule is registered with the `scheduler` that is responsible to trigger the watch based on the schedule. This is effectively time based triggering of a `watch`.

Thinking about it further, triggering a watch is a higher abstraction than the schedule. Many things can potentially trigger a watch - a schedule (or time based triggering) is just one example of such trigger.

A `Trigger` was added to provide this abstraction. A `watch` is associated with a `trigger` not with a `schedule` directly. One type of `trigger` that can be set on a watch is a `schedule`.

This abstraction will enable us much flexibility in the future as we'll be able to add other types of triggers that are not necessarily based on time. 3 examples:

- we're planning to have a API that executes triggers on demand (rather than waiting for them to be triggered "naturally"). We could have a `"passive"` trigger with the intention to have a watch that can only be executed on demand. Today (with schedule only) you can achieve this by setting a `cron` schedule that is set to trigger very far in the future - but it's a hack.

- In the future we plan to have changes API in elasticsearch. An interesting trigger that we might want to add is `"changes"` - an ESP (event-stream processing) trigger that listens to all (data) events in the changes API, processes them and using some sort of state machine decides to trigger a watch based on some condition.

- With Shield we have audit trails. currently the only audit trail that is supported is log based (access logs). Another audit trail we'll add soon will be index based (indexing the audit info to elasticsearch). In the future, we might want to have `watcher` extend shield and add a `"watcher"` audit trail. this will effectively be a `"audit"` trigger that will trigger watches based on events arriving in the audit trail (think about notifying at real-time about a potential DDoS attack)

To support this change, we needed to change existing and introduce new constructs:

- A `Trigger` defines the logic of when a watch should be triggered
- A `TriggerEngine` is responsible for executing the logic defined by the `Trigger`
- A `TriggerEvent` is created whenever the engine triggers the trigger. The event holds relevant information (may be different for every trigger depending on its type and nature).
- A `TriggerService` manages trigger engines.

We currently have a single engine implementation - a `"scheduler"` trigger

- `ScheduleTrigger` defines a clock/calendar based schedule on which a watch should be triggered
- `QuartzScheduleEngine` a trigger engine that runs quartz scheduler which triggers the registered schedules.
- `ScheduleTriggerEvent` holds the `triggered_time` (the time the trigger was actually triggered) and the `scheduled_time` (the time the trigger was scheduled to trigger)

- Updated the docs

Closes elastic/elasticsearch#158

Original commit: elastic/x-pack-elasticsearch@5be20917cc
2015-03-30 14:44:35 +02:00
dev-tools Add missing license check files. 2014-11-07 10:57:59 +00:00
src Introducing the `Trigger` notion 2015-03-30 14:44:35 +02:00
LICENSE.txt Initial X-Pack commit 2018-04-20 14:16:58 -07:00
README.asciidoc [docs] added docs for input, schedule and condition 2015-03-19 12:07:20 -07:00
all-signatures.txt [cleanup] - added forbidden apis mvn plugin 2015-02-17 16:31:18 +01:00
core-signatures.txt [cleanup] - added forbidden apis mvn plugin 2015-02-17 16:31:18 +01:00
pom.xml Integration with Shield 2015-03-27 20:19:19 +01:00
test-signatures.txt [cleanup] - added forbidden apis mvn plugin 2015-02-17 16:31:18 +01:00
tests.policy Build: Configure randomizedtesting properly 2014-11-07 14:24:56 +01:00

README.asciidoc

= Elasticsearch Alerts Plugin

This plugins adds alerting features to elasticsearch

You can build the plugin with `mvn package`.

The documentation is put in the `docs/` directory.