Search in sources :

Example 6 with SupervisorSummary

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

the class Nimbus method extractSupervisorMetrics.

private static Map<IClusterMetricsConsumer.SupervisorInfo, List<DataPoint>> extractSupervisorMetrics(ClusterSummary summ) {
    Map<IClusterMetricsConsumer.SupervisorInfo, List<DataPoint>> ret = new HashMap<>();
    for (SupervisorSummary sup : summ.get_supervisors()) {
        List<DataPoint> metrics = new ArrayList<>();
        metrics.add(new DataPoint("slotsTotal", sup.get_num_workers()));
        metrics.add(new DataPoint("slotsUsed", sup.get_num_used_workers()));
        metrics.add(new DataPoint("totalMem", sup.get_total_resources().get(Constants.COMMON_TOTAL_MEMORY_RESOURCE_NAME)));
        metrics.add(new DataPoint("totalCpu", sup.get_total_resources().get(Constants.COMMON_CPU_RESOURCE_NAME)));
        metrics.add(new DataPoint("usedMem", sup.get_used_mem()));
        metrics.add(new DataPoint("usedCpu", sup.get_used_cpu()));
        IClusterMetricsConsumer.SupervisorInfo info = new IClusterMetricsConsumer.SupervisorInfo(sup.get_host(), sup.get_supervisor_id(), Time.currentTimeSecs());
        ret.put(info, metrics);
    }
    return ret;
}
Also used : HashMap(java.util.HashMap) DataPoint(org.apache.storm.metric.api.DataPoint) IClusterMetricsConsumer(org.apache.storm.metric.api.IClusterMetricsConsumer) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) SupervisorSummary(org.apache.storm.generated.SupervisorSummary) SupervisorInfo(org.apache.storm.generated.SupervisorInfo)

Aggregations

SupervisorSummary (org.apache.storm.generated.SupervisorSummary)6 ArrayList (java.util.ArrayList)5 DataPoint (org.apache.storm.metric.api.DataPoint)4 HashMap (java.util.HashMap)3 List (java.util.List)3 SupervisorInfo (org.apache.storm.generated.SupervisorInfo)3 TopologySummary (org.apache.storm.generated.TopologySummary)3 WorkerMetricPoint (org.apache.storm.generated.WorkerMetricPoint)3 Map (java.util.Map)2 NavigableMap (java.util.NavigableMap)2 IStormClusterState (org.apache.storm.cluster.IStormClusterState)2 ClusterSummary (org.apache.storm.generated.ClusterSummary)2 NimbusSummary (org.apache.storm.generated.NimbusSummary)2 NodeInfo (org.apache.storm.generated.NodeInfo)2 SupervisorPageInfo (org.apache.storm.generated.SupervisorPageInfo)2 WorkerSummary (org.apache.storm.generated.WorkerSummary)2 TException (org.apache.storm.thrift.TException)2 Joiner (com.google.common.base.Joiner)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 Lists (com.google.common.collect.Lists)1