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;
}
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;
}
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;
}
}
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;
}
Aggregations