use of org.apache.storm.generated.ExecutorSummary in project storm by apache.
the class UIHelpers method getBoltExecutors.
/**
* getBoltExecutors.
* @param executorSummaries executorSummaries
* @param stormTopology stormTopology
* @param sys sys
* @return getBoltExecutors.
*/
public static Map<String, List<ExecutorSummary>> getBoltExecutors(List<ExecutorSummary> executorSummaries, StormTopology stormTopology, boolean sys) {
Map<String, List<ExecutorSummary>> result = new HashMap();
for (ExecutorSummary executorSummary : executorSummaries) {
if (StatsUtil.componentType(stormTopology, executorSummary.get_component_id()).equals("bolt") && (sys || !Utils.isSystemId(executorSummary.get_component_id()))) {
List<ExecutorSummary> executorSummaryList = result.getOrDefault(executorSummary.get_component_id(), new ArrayList());
executorSummaryList.add(executorSummary);
result.put(executorSummary.get_component_id(), executorSummaryList);
}
}
return result;
}
use of org.apache.storm.generated.ExecutorSummary in project storm by apache.
the class UIHelpers method getBoltExecutorStats.
/**
* getBoltExecutorStats.
* @param topologyId topologyId
* @param config config
* @param executorAggregateStats executorAggregateStats
* @return getBoltExecutorStats
*/
private static Map<String, Object> getBoltExecutorStats(String topologyId, Map<String, Object> config, ExecutorAggregateStats executorAggregateStats) {
Map<String, Object> result = new HashMap();
ExecutorSummary executorSummary = executorAggregateStats.get_exec_summary();
ExecutorInfo executorInfo = executorSummary.get_executor_info();
String executorId = prettyExecutorInfo(executorInfo);
result.put("id", executorId);
result.put("encodedId", Utils.urlEncodeUtf8(executorId));
result.put("uptime", prettyUptimeSec(executorSummary.get_uptime_secs()));
result.put("uptimeSeconds", executorSummary.get_uptime_secs());
String host = executorSummary.get_host();
result.put("host", host);
int port = executorSummary.get_port();
result.put("port", port);
ComponentAggregateStats componentAggregateStats = executorAggregateStats.get_stats();
CommonAggregateStats commonAggregateStats = componentAggregateStats.get_common_stats();
result.put("emitted", nullToZero(commonAggregateStats.get_emitted()));
result.put("transferred", nullToZero(commonAggregateStats.get_transferred()));
SpecificAggregateStats specificAggregateStats = componentAggregateStats.get_specific_stats();
BoltAggregateStats boltAggregateStats = specificAggregateStats.get_bolt();
result.put("capacity", StatsUtil.floatStr(nullToZero(boltAggregateStats.get_capacity())));
result.put("executeLatency", StatsUtil.floatStr(boltAggregateStats.get_execute_latency_ms()));
result.put("executed", nullToZero(boltAggregateStats.get_executed()));
result.put("processLatency", StatsUtil.floatStr(boltAggregateStats.get_process_latency_ms()));
result.put("acked", nullToZero(commonAggregateStats.get_acked()));
result.put("failed", nullToZero(commonAggregateStats.get_failed()));
result.put("workerLogLink", getWorkerLogLink(host, port, config, topologyId));
return result;
}
use of org.apache.storm.generated.ExecutorSummary in project storm by apache.
the class UIHelpers method getSpoutExecutorStats.
/**
* getSpoutExecutorStats.
* @param topologyId topologyId
* @param config config
* @param executorAggregateStats executorAggregateStats
* @return getSpoutExecutorStats
*/
private static Map<String, Object> getSpoutExecutorStats(String topologyId, Map<String, Object> config, ExecutorAggregateStats executorAggregateStats) {
Map<String, Object> result = new HashMap();
ExecutorSummary executorSummary = executorAggregateStats.get_exec_summary();
ExecutorInfo executorInfo = executorSummary.get_executor_info();
ComponentAggregateStats componentAggregateStats = executorAggregateStats.get_stats();
SpecificAggregateStats specificAggregateStats = componentAggregateStats.get_specific_stats();
SpoutAggregateStats spoutAggregateStats = specificAggregateStats.get_spout();
CommonAggregateStats commonAggregateStats = componentAggregateStats.get_common_stats();
String executorId = prettyExecutorInfo(executorInfo);
result.put("id", executorId);
result.put("encodedId", Utils.urlEncodeUtf8(executorId));
result.put("uptime", prettyUptimeSec(executorSummary.get_uptime_secs()));
result.put("uptimeSeconds", executorSummary.get_uptime_secs());
String host = executorSummary.get_host();
result.put("host", host);
int port = executorSummary.get_port();
result.put("port", port);
result.put("emitted", nullToZero(commonAggregateStats.get_emitted()));
result.put("transferred", nullToZero(commonAggregateStats.get_transferred()));
result.put("completeLatency", StatsUtil.floatStr(spoutAggregateStats.get_complete_latency_ms()));
result.put("acked", nullToZero(commonAggregateStats.get_acked()));
result.put("failed", nullToZero(commonAggregateStats.get_failed()));
result.put("workerLogLink", getWorkerLogLink(host, port, config, topologyId));
return result;
}
use of org.apache.storm.generated.ExecutorSummary in project storm by apache.
the class StatsUtil method aggregateCommonStats.
/**
* aggregate common stats from a spout/bolt, called in aggregateSpoutStats/aggregateBoltStats.
*/
public static <T> Map<String, Map<String, Map<T, Long>>> aggregateCommonStats(List<ExecutorSummary> statsSeq) {
Map<String, Map<String, Map<T, Long>>> ret = new HashMap<>();
List<Map<String, Map<String, Long>>> emitted = new ArrayList<>();
List<Map<String, Map<String, Long>>> transferred = new ArrayList<>();
for (ExecutorSummary summ : statsSeq) {
emitted.add(summ.get_stats().get_emitted());
transferred.add(summ.get_stats().get_transferred());
}
((Map) ret).put(EMITTED, aggregateCounts(emitted));
((Map) ret).put(TRANSFERRED, aggregateCounts(transferred));
return ret;
}
use of org.apache.storm.generated.ExecutorSummary in project storm by apache.
the class StatsUtil method thriftifyExecAggStats.
private static ExecutorAggregateStats thriftifyExecAggStats(String compId, String compType, Map m) {
ExecutorSummary executorSummary = new ExecutorSummary();
List executor = (List) m.get(EXECUTOR_ID);
executorSummary.set_executor_info(new ExecutorInfo(((Number) executor.get(0)).intValue(), ((Number) executor.get(1)).intValue()));
executorSummary.set_component_id(compId);
executorSummary.set_host((String) m.get(HOST));
executorSummary.set_port(getByKeyOr0(m, PORT).intValue());
int uptime = getByKeyOr0(m, ClientStatsUtil.UPTIME).intValue();
executorSummary.set_uptime_secs(uptime);
ExecutorAggregateStats stats = new ExecutorAggregateStats();
stats.set_exec_summary(executorSummary);
if (compType.equals(ClientStatsUtil.SPOUT)) {
stats.set_stats(thriftifySpoutAggStats(m));
} else {
stats.set_stats(thriftifyBoltAggStats(m));
}
return stats;
}
Aggregations