...
Code Block | ||
---|---|---|
| ||
// Template Interface and GeneralPolicyTemplateDesc for API interface GeneralPolicyTemplate { Class<?> getType(); // org.apache.eagle.policy.GeneralPolicyTemplate String getName(); // "SINGLE_SOURCE_THRESHOLD_ALERT" String getDescription(); // "An alert policy template consuming single stream source." String getCreateForm(); // "/path/to/create/form" String getEditForm(); // "/path/to/create/form" String getViewForm(); // "/path/to/create/form" Class<GeneralPolicyConfig>GeneralPolicyConfig getConfigTyperenderConfig(String); PolicyDefinition renderrenderPolicy(GeneralPolicyConfig); } // Static Template Metadata} GeneralPolicyEntity { config: GeneralPolicyTemplateConfig, template: "org.apache.eagle.policy.GeneralPolicyTemplate" } // GeneralPolicyTemplateConfig GeneralPolicyTemplateConfig{ internal: String, // json string } // Case Example SingleStreamThresholdPolicyTemplateConfig extend GeneralPolicyTemplateConfig { from: HDFS_AUDIT_SRC_STREAM, partition: { type: "GROUPBY",field: "USER" }, window: { type: "SLIDING_WINDOW", configs: { length: "20 hour" } }, aggregators: [ { function: "SUM", field: "USER", alias: "USER_COUNT" } ], filters: [ { field: "USER_COUNT", function: ">", value: 20 }, { field: "USER", function: "NOT IN", value: "HADOOP, HDFS, MAPRED" } ] } |
...