You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

Policy Creator UI Design 

General Mode

Policy Editor (General Mode) mainly supports some general alert template and provide easy-to-use template form and general native eagle policy in backend using the submitted form data and policy template.

Backend Support

 

// 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 getView(); // "/path/to/form"
	
    Class<GeneralPolicyConfig> getConfigType();
    PolicyDefinition render(GeneralPolicyConfig);
}
 
// Static Template Metadata}
GeneralPolicyEntity {
	config: GeneralPolicyTemplateConfig,
	template: "org.apache.eagle.policy.GeneralPolicyTemplate"
}
 
// 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"
        }
    ]
}

Embedded Mode

Advanced Mode

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • No labels