Open-IoT-Service-Platform / platform-launcher

Apache License 2.0
16 stars 16 forks source link

Rule engine - move to StreamingSQL #518

Closed wagmarcel closed 2 years ago

wagmarcel commented 3 years ago

Relates to #516

wagmarcel commented 3 years ago

Fairly simple with single or "ORed" conditions because these handled separately, e.g. insert into alerts select 'this is an alert' from metrics where cid='abc' and value > 10;

Tougher problems if you have AND between conditions because then you need to build up a tree of dependent conditions and several intermediate state, solvable with state tables Concept: versioned table joins: Every object in the table has a version/timestamp for instance: (ruleId, leftCondition, rightCondition, ts) - you can always query the most recent version (keyed by ruleId), e.g. when you set leftCondition to TRUE the current version would return TRUE for leftCondition.

Alerta assumes many alerts triggered to be able to set and reset alerts - so far in OISP we did not clear alerts automatically, same alerts are listed as different. For Alerta we have now to send the clearance, if the condition is no longer true

wagmarcel commented 2 years ago

Decision: Describe Rules with the SHACL standard