public ReducedMetric scope(String key) { ReducedMetric val = _value.get(key); if (val == null) { _value.put(key, val = new ReducedMetric(_reducer)); } return val; }
public Object getValueAndReset() { Map ret = new HashMap(); for (Map.Entry<String, ReducedMetric> e : _value.entrySet()) { Object val = e.getValue().getValueAndReset(); if (val != null) { ret.put(e.getKey(), val); } } return ret; } }
private ByteBufferMessageSet fetchMessages(SimpleConsumer consumer, Partition partition, long offset) { long start = System.nanoTime(); ByteBufferMessageSet msgs = KafkaUtils.fetchMessages(_config, consumer, partition, offset); long end = System.nanoTime(); long millis = (end - start) / 1000000; _kafkaMeanFetchLatencyMetric.update(millis); _kafkaMaxFetchLatencyMetric.update(millis); return msgs; }
@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); } }
public ReducedMetric registerMetric(String name, IReducer reducer, int timeBucketSizeInSecs) { return _topoContext.registerMetric(name, new ReducedMetric(reducer), timeBucketSizeInSecs); }
public Object getValueAndReset() { Map<String, Object> ret = new HashMap<>(); for (Map.Entry<String, ReducedMetric> e : value.entrySet()) { Object val = e.getValue().getValueAndReset(); if (val != null) { ret.put(e.getKey(), val); } } return ret; } }
@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); } }
public ReducedMetric registerMetric(String name, IReducer reducer, int timeBucketSizeInSecs) { return registerMetric(name, new ReducedMetric(reducer), timeBucketSizeInSecs); }
public Object getValueAndReset() { Map ret = new HashMap(); for(Map.Entry<String, ReducedMetric> e : _value.entrySet()) { Object val = e.getValue().getValueAndReset(); if(val != null) { ret.put(e.getKey(), val); } } return ret; } }
@Override public void reportConditionEfficiency(String ruleGroup, short ruleId, long executeTime) { conditionEfficiency.scope(Utils.concat(ruleGroup, TENANTID_SEPARATOR, String.valueOf(ruleId))) .update(executeTime); }
public ReducedMetric scope(String key) { ReducedMetric val = _value.get(key); if (val == null) { _value.put(key, val = new ReducedMetric(_reducer)); } return val; }
public Object getValueAndReset() { Map ret = new HashMap(); for (Map.Entry<String, ReducedMetric> e : _value.entrySet()) { Object val = e.getValue().getValueAndReset(); if (val != null) { ret.put(e.getKey(), val); } } return ret; } }
@Override public void reportRuleEfficiency(String ruleGroup, short ruleId, long executeTime) { ruleEfficiency.scope(Utils.concat(ruleGroup, TENANTID_SEPARATOR, String.valueOf(ruleId))).update(executeTime); }
public ReducedMetric scope(String key) { ReducedMetric val = _value.get(key); if(val == null) { _value.put(key, val = new ReducedMetric(_reducer)); } return val; }
public Map getMetricsDataMap() { Map ret = new HashMap(); ret.put(_partition + "/fetchAPILatencyMax", _fetchAPILatencyMax.getValueAndReset()); ret.put(_partition + "/fetchAPILatencyMean", _fetchAPILatencyMean.getValueAndReset()); ret.put(_partition + "/fetchAPICallCount", _fetchAPICallCount.getValueAndReset()); ret.put(_partition + "/fetchAPIMessageCount", _fetchAPIMessageCount.getValueAndReset()); return ret; }
private void fill() { long start = System.nanoTime(); ByteBufferMessageSet msgs = KafkaUtils.fetchMessages(_spoutConfig, _consumer, _partition, _emittedToOffset); long end = System.nanoTime(); long millis = (end - start) / 1000000; _fetchAPILatencyMax.update(millis); _fetchAPILatencyMean.update(millis); _fetchAPICallCount.incr(); int numMessages = countMessages(msgs); _fetchAPIMessageCount.incrBy(numMessages); if (numMessages > 0) { LOG.info("Fetched " + numMessages + " messages from: " + _partition); } for (MessageAndOffset msg : msgs) { _pending.add(_emittedToOffset); _waitingToEmit.add(new MessageAndRealOffset(msg.message(), _emittedToOffset)); _emittedToOffset = msg.nextOffset(); } if (numMessages > 0) { LOG.info("Added " + numMessages + " messages from: " + _partition + " to internal buffers"); } }
public ReducedMetric scope(String key) { ReducedMetric val = value.get(key); if (val == null) { value.put(key, val = new ReducedMetric(reducer)); } return val; }
alert.setRuleGroup(ruleGroup); time = System.nanoTime() - time; templateEfficiency.scope(String.valueOf(templateId)).update(time); return alert; } else {
public ReducedMetric registerMetric(String name, IReducer reducer, int timeBucketSizeInSecs) { return _topoContext.registerMetric(name, new ReducedMetric(reducer), timeBucketSizeInSecs); } public CombinedMetric registerMetric(String name, ICombiner combiner, int timeBucketSizeInSecs) {
alert.setTimestamp(timestamp); time = System.nanoTime() - time; templateEfficiency.scope(String.valueOf(templateId)).update(time); return alert; } else {