Search in sources :

Example 6 with ExecutorSummary

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;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) ExecutorSummary(org.apache.storm.generated.ExecutorSummary)

Example 7 with ExecutorSummary

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;
}
Also used : ExecutorInfo(org.apache.storm.generated.ExecutorInfo) HashMap(java.util.HashMap) SpecificAggregateStats(org.apache.storm.generated.SpecificAggregateStats) ComponentAggregateStats(org.apache.storm.generated.ComponentAggregateStats) ExecutorSummary(org.apache.storm.generated.ExecutorSummary) CommonAggregateStats(org.apache.storm.generated.CommonAggregateStats) BoltAggregateStats(org.apache.storm.generated.BoltAggregateStats)

Example 8 with ExecutorSummary

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;
}
Also used : ExecutorInfo(org.apache.storm.generated.ExecutorInfo) HashMap(java.util.HashMap) SpecificAggregateStats(org.apache.storm.generated.SpecificAggregateStats) ComponentAggregateStats(org.apache.storm.generated.ComponentAggregateStats) SpoutAggregateStats(org.apache.storm.generated.SpoutAggregateStats) ExecutorSummary(org.apache.storm.generated.ExecutorSummary) CommonAggregateStats(org.apache.storm.generated.CommonAggregateStats)

Example 9 with ExecutorSummary

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;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) HashMap(java.util.HashMap) Map(java.util.Map) ExecutorSummary(org.apache.storm.generated.ExecutorSummary)

Example 10 with ExecutorSummary

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;
}
Also used : ExecutorInfo(org.apache.storm.generated.ExecutorInfo) ExecutorAggregateStats(org.apache.storm.generated.ExecutorAggregateStats) ArrayList(java.util.ArrayList) List(java.util.List) ExecutorSummary(org.apache.storm.generated.ExecutorSummary)

Aggregations

ExecutorSummary (org.apache.storm.generated.ExecutorSummary)24 HashMap (java.util.HashMap)14 ArrayList (java.util.ArrayList)13 TopologyInfo (org.apache.storm.generated.TopologyInfo)13 Map (java.util.Map)12 List (java.util.List)9 ExecutorStats (org.apache.storm.generated.ExecutorStats)8 HashSet (java.util.HashSet)6 SpoutStats (org.apache.storm.generated.SpoutStats)6 ExecutorInfo (org.apache.storm.generated.ExecutorInfo)5 TopologySummary (org.apache.storm.generated.TopologySummary)5 ImmutableMap (com.google.common.collect.ImmutableMap)4 File (java.io.File)4 Collectors (java.util.stream.Collectors)4 Config (org.apache.storm.Config)4 ExecutorAggregateStats (org.apache.storm.generated.ExecutorAggregateStats)4 StormTopology (org.apache.storm.generated.StormTopology)4 Logger (org.slf4j.Logger)4 LoggerFactory (org.slf4j.LoggerFactory)4 IOException (java.io.IOException)3