@Override public void reportConditionEfficiency(String ruleGroup, short ruleId, long executeTime) { if (multiTenancyActive) { conditionEfficiency.scope(Utils.concat(ruleGroup, TENANTID_SEPARATOR, String.valueOf(ruleId))) .update(executeTime); } else { conditionEfficiency.scope(String.valueOf(ruleId)).update(executeTime); } }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { this.multiTenancyActive = Boolean .parseBoolean(stormConf.getOrDefault(Constants.RULE_GROUP_ACTIVE, Constants.FALSE).toString()); this.collector = collector; this.gson = new Gson(); this.templateMap = new HashMap<>(); this.storeFactory = new UnifiedFactory(); this.runtimeServices = RuntimeSingleton.getRuntimeServices(); try { initializeTemplates(runtimeServices, templateMap, storeFactory, stormConf); } catch (Exception e) { logger.log(Level.SEVERE, "Failed to initialize templates for alerts", e); throw new RuntimeException(e); } templateEfficiency = new MultiReducedMetric(new MeanReducer()); templateHit = new MultiCountMetric(); if (context != null) { context.registerMetric(_METRIC_TEMPLATE_EFFICIENCY, templateEfficiency, Constants.METRICS_FREQUENCY); context.registerMetric(_METRIC_TEMPLATE_HIT, templateHit, Constants.METRICS_FREQUENCY); } logger.info("Templated alerting Engine Bolt initialized"); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { this.collector = collector; this.gson = new Gson(); this.templateMap = new HashMap<>(); this.storeFactory = new UnifiedFactory(); this.runtimeServices = RuntimeSingleton.getRuntimeServices(); try { initializeTemplates(runtimeServices, templateMap, storeFactory, stormConf); } catch (Exception e) { logger.log(Level.SEVERE, "Failed to initialize templates for alerts", e); throw new RuntimeException(e); } templateEfficiency = new MultiReducedMetric(new MeanReducer()); templateHit = new MultiCountMetric(); if (context != null) { context.registerMetric(_METRIC_TEMPLATE_EFFICIENCY, templateEfficiency, Constants.METRICS_FREQUENCY); context.registerMetric(_METRIC_TEMPLATE_HIT, templateHit, Constants.METRICS_FREQUENCY); } logger.info("Templated alerting Engine Bolt initialized"); }
@Override public void reportRuleEfficiency(String ruleGroup, short ruleId, long executeTime) { if (multiTenancyActive) { ruleEfficiency.scope(Utils.concat(ruleGroup, TENANTID_SEPARATOR, String.valueOf(ruleId))) .update(executeTime); } else { ruleEfficiency.scope(String.valueOf(ruleId)).update(executeTime); } }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { this.multiTenancyActive = Boolean .parseBoolean(stormConf.getOrDefault(Constants.RULE_GROUP_ACTIVE, Constants.FALSE).toString()); this.logger = Logger.getLogger(RulesEngineBolt.class.getName()); UnifiedFactory factory = new UnifiedFactory(); this.rulesEngine = new StatelessRulesEngine<Tuple, OutputCollector>(this, factory, factory); try { this.rulesEngine.initializeRules(stormConf); } catch (Exception e) { throw new RuntimeException(e); } this.gson = new Gson(); this.collector = collector; this.ruleEfficiency = new MultiReducedMetric(new MeanReducer()); this.conditionEfficiency = new MultiReducedMetric(new MeanReducer()); this.ruleHitCount = new MultiCountMetric(); this.ruleNoHitCount = new MultiCountMetric(); if (context != null) { context.registerMetric(_METRIC_RULE_EFFICIENCY, ruleEfficiency, Constants.METRICS_FREQUENCY); context.registerMetric(_METRIC_CONDITION_EFFICIENCY, conditionEfficiency, Constants.METRICS_FREQUENCY); context.registerMetric(_METRIC_RULE_HIT_COUNT, ruleHitCount, Constants.METRICS_FREQUENCY); context.registerMetric(_METRIC_RULE_NO_HIT_COUNT, ruleHitCount, Constants.METRICS_FREQUENCY); } logger.info("Rules Engine Bolt initialized"); }
@Override public void reportConditionEfficiency(String ruleGroup, short ruleId, long executeTime) { conditionEfficiency.scope(Utils.concat(ruleGroup, TENANTID_SEPARATOR, String.valueOf(ruleId))) .update(executeTime); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { this.logger = Logger.getLogger(RulesEngineBolt.class.getName()); UnifiedFactory factory = new UnifiedFactory(); this.rulesEngine = new StatelessRulesEngine<Tuple, OutputCollector>(this, factory, factory); try { this.rulesEngine.initialize(stormConf); } catch (Exception e) { throw new RuntimeException(e); } this.gson = new Gson(); this.collector = collector; this.ruleEfficiency = new MultiReducedMetric(new MeanReducer()); this.conditionEfficiency = new MultiReducedMetric(new MeanReducer()); this.ruleHitCount = new MultiCountMetric(); this.ruleNoHitCount = new MultiCountMetric(); if (context != null) { context.registerMetric(_METRIC_RULE_EFFICIENCY, ruleEfficiency, Constants.METRICS_FREQUENCY); context.registerMetric(_METRIC_CONDITION_EFFICIENCY, conditionEfficiency, Constants.METRICS_FREQUENCY); context.registerMetric(_METRIC_RULE_HIT_COUNT, ruleHitCount, Constants.METRICS_FREQUENCY); context.registerMetric(_METRIC_RULE_NO_HIT_COUNT, ruleHitCount, Constants.METRICS_FREQUENCY); } logger.info("Rules Engine Bolt initialized"); }
@Override public void reportRuleEfficiency(String ruleGroup, short ruleId, long executeTime) { ruleEfficiency.scope(Utils.concat(ruleGroup, TENANTID_SEPARATOR, String.valueOf(ruleId))).update(executeTime); }
alert.setTimestamp(timestamp); time = System.nanoTime() - time; templateEfficiency.scope(String.valueOf(templateId)).update(time); return alert; } else {
alert.setRuleGroup(ruleGroup); time = System.nanoTime() - time; templateEfficiency.scope(String.valueOf(templateId)).update(time); return alert; } else {