Search in sources :

Example 1 with ClusterWorkerHeartbeat

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

the class StatsUtil method thriftifyZkWorkerHb.

// =====================================================================================
// thriftify stats methods
// =====================================================================================
public static ClusterWorkerHeartbeat thriftifyZkWorkerHb(Map<String, Object> heartbeat) {
    ClusterWorkerHeartbeat ret = new ClusterWorkerHeartbeat();
    ret.set_uptime_secs(getByKeyOr0(heartbeat, UPTIME).intValue());
    ret.set_storm_id((String) getByKey(heartbeat, "storm-id"));
    ret.set_time_secs(getByKeyOr0(heartbeat, TIME_SECS).intValue());
    Map<ExecutorInfo, ExecutorStats> convertedStats = new HashMap<>();
    Map<List<Integer>, ExecutorStats> executorStats = getMapByKey(heartbeat, EXECUTOR_STATS);
    if (executorStats != null) {
        for (Map.Entry<List<Integer>, ExecutorStats> entry : executorStats.entrySet()) {
            List<Integer> executor = entry.getKey();
            ExecutorStats stats = entry.getValue();
            if (null != stats) {
                convertedStats.put(new ExecutorInfo(executor.get(0), executor.get(1)), stats);
            }
        }
    }
    ret.set_executor_stats(convertedStats);
    return ret;
}
Also used : ExecutorInfo(org.apache.storm.generated.ExecutorInfo) HashMap(java.util.HashMap) ExecutorStats(org.apache.storm.generated.ExecutorStats) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) ClusterWorkerHeartbeat(org.apache.storm.generated.ClusterWorkerHeartbeat)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 ClusterWorkerHeartbeat (org.apache.storm.generated.ClusterWorkerHeartbeat)1 ExecutorInfo (org.apache.storm.generated.ExecutorInfo)1 ExecutorStats (org.apache.storm.generated.ExecutorStats)1