Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Eagle Topology failed to Start if it finds invalid Policy.

JIRA - EAGLE-95


Implemented Design

  1. Define new methods in the PolicyEvaluator interface - isMarkdownEnabled() and getMarkdownReason()
  2. It is PolicyEvaluator implementation's responsibility to determine if the policy is marked down or not. In our case, SiddhiPolicyEvaluator and MLPolicyEvaluator should implement this above interface.
    1. For SiddhiPolicyEvaluator, we can catch exception at createSiddhiRuntime method, then markdown this policy by setting two field (markdownEnabled - in case of SiddhiParserException exception & mardownReason - the exception message) in the SiddhiRuntime object returned. The ExecutionPlanRuntime will be made null and will not be attempted to start in case of an exception.
    2. For MLPolicyyEvaluator, at present there is no logic implemented to determine markdown and so will be returning false for isMarkdowEnabled by default.
  3. It is PolicyProcessExecutor responsibility to report markdown status back to eagle service. So at createPolicyEvaluator() and onPolicyChanged(), after creating/updating SiddhiRuntime we make a call to the Eagle WebService to update the markdown details for the policy maintained in the "alertdef" table. In the PolicyProcessExecutor.flatMap(), we check if the markdown is enabled or not to evaluate.

 

Proposed Design (drafts)

#1 Identifying an invalid query (using SiddhiCompiler)

...

From the request payload, the policyDef tag contains the values of the type of the policy and the actual policy (given in bold below)

 

[{d
    “tags”: {
        “site”: “sandbox”, “dataSource”: “hdfsAuditLog”, “policyId”: “testPolicy”, “alertExecutorId”: “hdfsAuditLogAlertExecutor”, “policyType”: “siddhiCEPEngine”
    },
    “desc”: “test alert policy”,
    "policyDef": "{"type":"siddhiCEPEngine","expression":"from hdfsAuditLogEventStream[src =='/tmp/private'] select * insert into outputStream;"}",
    “notificationDef”: “[{
        “sender”:”noreply-eagle@company.com”, “recipients”:”user@company.com”, “subject”:”test alert policy”, “flavor”:”email”, “id”:”email_1”
    }]”,
    “enabled”: true
}]

...