/** * convert thrift ExecutorStats structure into a java HashMap. */ public static Map<String, Object> convertExecutorStats(ExecutorStats stats) { Map<String, Object> ret = new HashMap<>(); ret.put(EMITTED, stats.get_emitted()); ret.put(TRANSFERRED, stats.get_transferred()); ret.put(RATE, stats.get_rate()); if (stats.get_specific().is_set_bolt()) { ret.putAll(convertSpecificStats(stats.get_specific().get_bolt())); ret.put(TYPE, ClientStatsUtil.BOLT); } else { ret.putAll(convertSpecificStats(stats.get_specific().get_spout())); ret.put(TYPE, ClientStatsUtil.SPOUT); } return ret; }
public static ExecutorSpecificStats bolt(BoltStats value) { ExecutorSpecificStats x = new ExecutorSpecificStats(); x.set_bolt(value); return x; }
public static ExecutorSpecificStats spout(SpoutStats value) { ExecutorSpecificStats x = new ExecutorSpecificStats(); x.set_spout(value); return x; }
public SpoutStats get_spout() { if (getSetField() == _Fields.SPOUT) { return (SpoutStats)getFieldValue(); } else { throw new java.lang.RuntimeException("Cannot get field 'spout' because union is currently set to " + getFieldDesc(getSetField()).name); } }
Long count = txMap.get(key); totalTransferred += count; if (executorSpecificStats.is_set_spout()) { spoutTransferred += count; if (executorSpecificStats.isSet(2)) { // spout SpoutStats spoutStats = executorSpecificStats.get_spout(); Map<String, Long> acked = spoutStats.get_acked().get(":all-time"); if (acked != null) {
executors++; if (exec.get_stats() != null && exec.get_stats().get_specific() != null && exec.get_stats().get_specific().is_set_spout()) { SpoutStats stats = exec.get_stats().get_specific().get_spout(); Map<String, Long> failedMap = stats.get_failed().get(":all-time"); Map<String, Long> ackedMap = stats.get_acked().get(":all-time");
/** * aggregate spout stats. * * @param statsSeq a seq of ExecutorStats * @param includeSys whether to include system streams * @return aggregated spout stats: {metric -> win -> global stream id -> value} */ public static Map<String, Map> aggregateSpoutStats(List<ExecutorSummary> statsSeq, boolean includeSys) { // actually Map<String, Map<String, Map<String, Long/Double>>> Map<String, Map> ret = new HashMap<>(); Map<String, Map<String, Map<String, Long>>> commonStats = aggregateCommonStats(statsSeq); // filter sys streams if necessary commonStats = preProcessStreamSummary(commonStats, includeSys); List<Map<String, Map<String, Long>>> acked = new ArrayList<>(); List<Map<String, Map<String, Long>>> failed = new ArrayList<>(); List<Map<String, Map<String, Double>>> completeLatencies = new ArrayList<>(); for (ExecutorSummary summary : statsSeq) { ExecutorStats stats = summary.get_stats(); acked.add(stats.get_specific().get_spout().get_acked()); failed.add(stats.get_specific().get_spout().get_failed()); completeLatencies.add(stats.get_specific().get_spout().get_complete_ms_avg()); } ret.putAll(commonStats); ((Map) ret).put(ACKED, aggregateCounts(acked)); ((Map) ret).put(FAILED, aggregateCounts(failed)); ((Map) ret).put(COMP_LATENCIES, aggregateAverages(completeLatencies, acked)); return ret; }
private static ExecutorSpecificStats thriftifySpecificStats(Map stats) { ExecutorSpecificStats specificStats = new ExecutorSpecificStats(); String compType = (String) stats.get(TYPE); if (ClientStatsUtil.BOLT.equals(compType)) { BoltStats boltStats = new BoltStats(); boltStats.set_acked( ClientStatsUtil.windowSetConverter(ClientStatsUtil.getMapByKey(stats, ACKED), ClientStatsUtil.TO_GSID, TO_STRING)); boltStats.set_executed( ClientStatsUtil.windowSetConverter(ClientStatsUtil.getMapByKey(stats, EXECUTED), ClientStatsUtil.TO_GSID, TO_STRING)); boltStats.set_execute_ms_avg( ClientStatsUtil.windowSetConverter(ClientStatsUtil.getMapByKey(stats, EXEC_LATENCIES), ClientStatsUtil.TO_GSID, TO_STRING)); boltStats.set_failed( ClientStatsUtil.windowSetConverter(ClientStatsUtil.getMapByKey(stats, FAILED), ClientStatsUtil.TO_GSID, TO_STRING)); boltStats.set_process_ms_avg( ClientStatsUtil.windowSetConverter(ClientStatsUtil.getMapByKey(stats, PROC_LATENCIES), ClientStatsUtil.TO_GSID, TO_STRING)); specificStats.set_bolt(boltStats); } else { SpoutStats spoutStats = new SpoutStats(); spoutStats.set_acked(ClientStatsUtil.windowSetConverter(ClientStatsUtil.getMapByKey(stats, ACKED), TO_STRING, TO_STRING)); spoutStats.set_failed(ClientStatsUtil.windowSetConverter(ClientStatsUtil.getMapByKey(stats, FAILED), TO_STRING, TO_STRING)); spoutStats.set_complete_ms_avg( ClientStatsUtil.windowSetConverter(ClientStatsUtil.getMapByKey(stats, COMP_LATENCIES), TO_STRING, TO_STRING)); specificStats.set_spout(spoutStats); } return specificStats; }
struct.specific = new ExecutorSpecificStats(); struct.specific.read(iprot); struct.set_specific_isSet(true); struct.rate = iprot.readDouble();
public boolean equals(ExecutorSpecificStats other) { return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue()); }
public ExecutorSpecificStats deepCopy() { return new ExecutorSpecificStats(this); }
public boolean equals(java.lang.Object other) { if (other instanceof ExecutorSpecificStats) { return equals((ExecutorSpecificStats)other); } else { return false; } }
totalExecutors++; if (stats != null) { if (stats.get_specific().is_set_spout()) { SpoutStats ss = stats.get_specific().get_spout(); Map<String, Long> failedMap = ss.get_failed().get(":all-time"); if (failedMap != null) {
public BoltStats get_bolt() { if (getSetField() == _Fields.BOLT) { return (BoltStats)getFieldValue(); } else { throw new java.lang.RuntimeException("Cannot get field 'bolt' because union is currently set to " + getFieldDesc(getSetField()).name); } }
for (ExecutorSummary exec : info.get_executors()) { if ("spout".equals(exec.get_component_id())) { SpoutStats stats = exec.get_stats().get_specific().get_spout(); Map<String, Long> failedMap = stats.get_failed().get(":all-time"); Map<String, Long> ackedMap = stats.get_acked().get(":all-time");
case 3: // SPECIFIC if (schemeField.type == org.apache.storm.thrift.protocol.TType.STRUCT) { struct.specific = new ExecutorSpecificStats(); struct.specific.read(iprot); struct.set_specific_isSet(true); } else {
@Override public int compareTo(ExecutorSpecificStats other) { int lastComparison = org.apache.storm.thrift.TBaseHelper.compareTo(getSetField(), other.getSetField()); if (lastComparison == 0) { return org.apache.storm.thrift.TBaseHelper.compareTo(getFieldValue(), other.getFieldValue()); } return lastComparison; }
this.specific = new ExecutorSpecificStats(other.specific);
if (!(this_present_specific && that_present_specific)) return false; if (!this.specific.equals(that.specific)) return false;
public SpoutStats get_spout() { if (getSetField() == _Fields.SPOUT) { return (SpoutStats)getFieldValue(); } else { throw new RuntimeException("Cannot get field 'spout' because union is currently set to " + getFieldDesc(getSetField()).name); } }