@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"); }
@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"); }
@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"); }
_fetchAPILatencyMean = new ReducedMetric(new MeanReducer()); _fetchAPICallCount = new CountMetric(); _fetchAPIMessageCount = new CountMetric();
public TridentKafkaEmitter(Map conf, TopologyContext context, TridentKafkaConfig config, String topologyInstanceId) { _config = config; _topologyInstanceId = topologyInstanceId; _connections = new DynamicPartitionConnections(_config, KafkaUtils.makeBrokerReader(conf, _config)); _topologyName = (String) conf.get(Config.TOPOLOGY_NAME); _kafkaOffsetMetric = new KafkaUtils.KafkaOffsetMetric(_config.topic, _connections); context.registerMetric("kafkaOffset", _kafkaOffsetMetric, _config.metricsTimeBucketSizeInSecs); _kafkaMeanFetchLatencyMetric = context.registerMetric("kafkaFetchAvg", new MeanReducer(), _config.metricsTimeBucketSizeInSecs); _kafkaMaxFetchLatencyMetric = context.registerMetric("kafkaFetchMax", new MaxMetric(), _config.metricsTimeBucketSizeInSecs); }