Search in sources :

Example 1 with ExecutorAggregateStats

use of org.apache.storm.generated.ExecutorAggregateStats in project storm by apache.

the class TopoWrap method getLogUrls.

/**
 * Get the Logviewer worker log URLs for the specified component.
 */
public Set<ExecutorURL> getLogUrls(final String componentId) throws TException, MalformedURLException {
    ComponentPageInfo componentPageInfo = cluster.getNimbusClient().getComponentPageInfo(id, componentId, null, false);
    List<ExecutorAggregateStats> executorStats = componentPageInfo.get_exec_stats();
    Set<ExecutorURL> urls = new HashSet<>();
    for (ExecutorAggregateStats execStat : executorStats) {
        ExecutorSummary execSummary = execStat.get_exec_summary();
        String host = execSummary.get_host();
        int executorPort = execSummary.get_port();
        // http://supervisor2:8000/download/DemoTest-26-1462229009%2F6703%2Fworker.log
        // http://supervisor2:8000/log?file=SlidingWindowCountTest-9-1462388349%2F6703%2Fworker.log
        int logViewerPort = 8000;
        ExecutorURL executorURL = new ExecutorURL(componentId, host, logViewerPort, executorPort, id);
        urls.add(executorURL);
    }
    return urls;
}
Also used : ComponentPageInfo(org.apache.storm.generated.ComponentPageInfo) ExecutorAggregateStats(org.apache.storm.generated.ExecutorAggregateStats) HashSet(java.util.HashSet) ExecutorSummary(org.apache.storm.generated.ExecutorSummary)

Example 2 with ExecutorAggregateStats

use of org.apache.storm.generated.ExecutorAggregateStats 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)

Example 3 with ExecutorAggregateStats

use of org.apache.storm.generated.ExecutorAggregateStats in project storm by apache.

the class StatsUtil method thriftifyCompPageData.

private static ComponentPageInfo thriftifyCompPageData(String topologyId, StormTopology topology, String compId, Map<String, Object> data) {
    ComponentPageInfo ret = new ComponentPageInfo();
    ret.set_component_id(compId);
    Map win2stats = new HashMap();
    win2stats.put(EMITTED, ClientStatsUtil.getMapByKey(data, WIN_TO_EMITTED));
    win2stats.put(TRANSFERRED, ClientStatsUtil.getMapByKey(data, WIN_TO_TRANSFERRED));
    win2stats.put(ACKED, ClientStatsUtil.getMapByKey(data, WIN_TO_ACKED));
    win2stats.put(FAILED, ClientStatsUtil.getMapByKey(data, WIN_TO_FAILED));
    String compType = (String) data.get(TYPE);
    if (compType.equals(ClientStatsUtil.SPOUT)) {
        ret.set_component_type(ComponentType.SPOUT);
        win2stats.put(COMP_LATENCY, ClientStatsUtil.getMapByKey(data, WIN_TO_COMP_LAT));
    } else {
        ret.set_component_type(ComponentType.BOLT);
        win2stats.put(EXEC_LATENCY, ClientStatsUtil.getMapByKey(data, WIN_TO_EXEC_LAT));
        win2stats.put(PROC_LATENCY, ClientStatsUtil.getMapByKey(data, WIN_TO_PROC_LAT));
        win2stats.put(EXECUTED, ClientStatsUtil.getMapByKey(data, WIN_TO_EXECUTED));
    }
    win2stats = swapMapOrder(win2stats);
    List<ExecutorAggregateStats> execStats = new ArrayList<>();
    List executorStats = (List) data.get(ClientStatsUtil.EXECUTOR_STATS);
    if (executorStats != null) {
        for (Object o : executorStats) {
            execStats.add(thriftifyExecAggStats(compId, compType, (Map) o));
        }
    }
    Map gsid2inputStats;
    Map sid2outputStats;
    if (compType.equals(ClientStatsUtil.SPOUT)) {
        Map tmp = new HashMap();
        for (Object k : win2stats.keySet()) {
            tmp.put(k, thriftifySpoutAggStats((Map) win2stats.get(k)));
        }
        win2stats = tmp;
        gsid2inputStats = null;
        sid2outputStats = thriftifySpoutOutputStats(ClientStatsUtil.getMapByKey(data, SID_TO_OUT_STATS));
    } else {
        Map tmp = new HashMap();
        for (Object k : win2stats.keySet()) {
            tmp.put(k, thriftifyBoltAggStats((Map) win2stats.get(k)));
        }
        win2stats = tmp;
        gsid2inputStats = thriftifyBoltInputStats(ClientStatsUtil.getMapByKey(data, CID_SID_TO_IN_STATS));
        sid2outputStats = thriftifyBoltOutputStats(ClientStatsUtil.getMapByKey(data, SID_TO_OUT_STATS));
    }
    ret.set_num_executors(getByKeyOr0(data, NUM_EXECUTORS).intValue());
    ret.set_num_tasks(getByKeyOr0(data, NUM_TASKS).intValue());
    ret.set_topology_id(topologyId);
    ret.set_topology_name(null);
    ret.set_window_to_stats(win2stats);
    ret.set_sid_to_output_stats(sid2outputStats);
    ret.set_exec_stats(execStats);
    ret.set_gsid_to_input_stats(gsid2inputStats);
    return ret;
}
Also used : ComponentPageInfo(org.apache.storm.generated.ComponentPageInfo) HashMap(java.util.HashMap) ExecutorAggregateStats(org.apache.storm.generated.ExecutorAggregateStats) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

ExecutorAggregateStats (org.apache.storm.generated.ExecutorAggregateStats)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ComponentPageInfo (org.apache.storm.generated.ComponentPageInfo)2 ExecutorSummary (org.apache.storm.generated.ExecutorSummary)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 ExecutorInfo (org.apache.storm.generated.ExecutorInfo)1