Search in sources :

Example 11 with ExecutorStats

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

the class StatsUtil method thriftifyExecutorStats.

public static ExecutorStats thriftifyExecutorStats(Map stats) {
    ExecutorStats ret = new ExecutorStats();
    ExecutorSpecificStats specificStats = thriftifySpecificStats(stats);
    ret.set_specific(specificStats);
    ret.set_emitted(windowSetConverter(getMapByKey(stats, EMITTED), TO_STRING, TO_STRING));
    ret.set_transferred(windowSetConverter(getMapByKey(stats, TRANSFERRED), TO_STRING, TO_STRING));
    ret.set_rate(((Number) getByKey(stats, RATE)).doubleValue());
    return ret;
}
Also used : ExecutorSpecificStats(org.apache.storm.generated.ExecutorSpecificStats) ExecutorStats(org.apache.storm.generated.ExecutorStats)

Example 12 with ExecutorStats

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

the class SpoutExecutorStats method renderStats.

@Override
public ExecutorStats renderStats() {
    ExecutorStats ret = new ExecutorStats();
    // common fields
    ret.set_emitted(valueStat(EMITTED));
    ret.set_transferred(valueStat(TRANSFERRED));
    ret.set_rate(this.rate);
    // spout stats
    SpoutStats spoutStats = new SpoutStats(valueStat(ACKED), valueStat(FAILED), valueStat(COMPLETE_LATENCIES));
    ret.set_specific(ExecutorSpecificStats.spout(spoutStats));
    return ret;
}
Also used : ExecutorStats(org.apache.storm.generated.ExecutorStats) SpoutStats(org.apache.storm.generated.SpoutStats)

Example 13 with ExecutorStats

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

the class StatsUtil method computeExecutorCapacity.

public static double computeExecutorCapacity(ExecutorSummary summary) {
    ExecutorStats stats = summary.get_stats();
    if (stats == null) {
        return 0.0;
    } else {
        // actual value of m is: Map<String, Map<String/GlobalStreamId, Long/Double>> ({win -> stream -> value})
        Map<String, Map> m = aggregateBoltStats(Lists.newArrayList(summary), true);
        // {metric -> win -> value} ==> {win -> metric -> value}
        m = swapMapOrder(aggregateBoltStreams(m));
        // {metric -> value}
        Map data = getMapByKey(m, TEN_MIN_IN_SECONDS_STR);
        int uptime = summary.get_uptime_secs();
        int win = Math.min(uptime, TEN_MIN_IN_SECONDS);
        long executed = getByKeyOr0(data, EXECUTED).longValue();
        double latency = getByKeyOr0(data, EXEC_LATENCIES).doubleValue();
        if (win > 0) {
            return executed * latency / (1000 * win);
        }
        return 0.0;
    }
}
Also used : ExecutorStats(org.apache.storm.generated.ExecutorStats) HashMap(java.util.HashMap) Map(java.util.Map)

Example 14 with ExecutorStats

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

the class ClusterUtils method convertExecutorBeats.

/**
     * Ensures that we only return heartbeats for executors assigned to this worker
     * @param executors
     * @param workerHeartbeat
     * @return
     */
public static Map<ExecutorInfo, ExecutorBeat> convertExecutorBeats(List<ExecutorInfo> executors, ClusterWorkerHeartbeat workerHeartbeat) {
    Map<ExecutorInfo, ExecutorBeat> executorWhb = new HashMap<>();
    Map<ExecutorInfo, ExecutorStats> executorStatsMap = workerHeartbeat.get_executor_stats();
    for (ExecutorInfo executor : executors) {
        if (executorStatsMap.containsKey(executor)) {
            int time = workerHeartbeat.get_time_secs();
            int uptime = workerHeartbeat.get_uptime_secs();
            ExecutorStats executorStats = workerHeartbeat.get_executor_stats().get(executor);
            ExecutorBeat executorBeat = new ExecutorBeat(time, uptime, executorStats);
            executorWhb.put(executor, executorBeat);
        }
    }
    return executorWhb;
}
Also used : ExecutorInfo(org.apache.storm.generated.ExecutorInfo) HashMap(java.util.HashMap) ExecutorStats(org.apache.storm.generated.ExecutorStats)

Aggregations

ExecutorStats (org.apache.storm.generated.ExecutorStats)14 HashMap (java.util.HashMap)10 Map (java.util.Map)9 ArrayList (java.util.ArrayList)7 List (java.util.List)5 ExecutorSummary (org.apache.storm.generated.ExecutorSummary)5 ExecutorInfo (org.apache.storm.generated.ExecutorInfo)4 ImmutableMap (com.google.common.collect.ImmutableMap)2 ExecutorSpecificStats (org.apache.storm.generated.ExecutorSpecificStats)2 SpoutStats (org.apache.storm.generated.SpoutStats)2 TopologyInfo (org.apache.storm.generated.TopologyInfo)2 IOException (java.io.IOException)1 InterruptedIOException (java.io.InterruptedIOException)1 BindException (java.net.BindException)1 Entry (java.util.Map.Entry)1 Nullable (javax.annotation.Nullable)1 IStormClusterState (org.apache.storm.cluster.IStormClusterState)1 AlreadyAliveException (org.apache.storm.generated.AlreadyAliveException)1 AuthorizationException (org.apache.storm.generated.AuthorizationException)1 BoltStats (org.apache.storm.generated.BoltStats)1