Pārlūkot izejas kodu

AMBARI-1198. Ambari API Performance: Parsing of Ganglia json data is slow. (jspeidel via mahadev)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1435419 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 12 gadi atpakaļ
vecāks
revīzija
03585c842f

+ 3 - 0
CHANGES.txt

@@ -43,6 +43,9 @@ Trunk (unreleased changes):
  AMBARI-1181. Clean up table header UI for sorting and filter clear "x" for
  Hosts table. (yusaku)
 
+ AMBARI-1198. Ambari API Performance: Parsing of Ganglia json data is slow.
+ (jspeidel via mahadev)
+
  BUG FIXES
 
  AMBARI-1203. mapred-site.xml default system directory is not set

+ 59 - 39
ambari-agent/src/main/puppet/modules/hdp-ganglia/files/rrd.py

@@ -19,67 +19,81 @@ limitations under the License.
 '''
 
 import cgi
-#import cgitb
 import os
 import rrdtool
 import sys
+import time
 
 # place this script in /var/www/cgi-bin of the Ganglia collector
 # requires 'yum install rrdtool-python' on the Ganglia collector
 
-#cgitb.enable()
 
-def printMetric(clusterName, hostName, metricName, file, cf, start, end, resolution):
+def printMetric(clusterName, hostName, metricName, file, cf, start, end, resolution, pointInTime):
   if clusterName.endswith("rrds"):
     clusterName = ""
 
   args = [file, cf]
 
   if start is not None:
-   args.extend(["-s", start])
+    args.extend(["-s", start])
 
   if end is not None:
-   args.extend(["-e", end])
+    args.extend(["-e", end])
 
   if resolution is not None:
-   args.extend(["-r", resolution])
+    args.extend(["-r", resolution])
 
   rrdMetric = rrdtool.fetch(args)
-
-  time = rrdMetric[0][0]
-  step = rrdMetric[0][2]
-
-  sys.stdout.write("  {\n    \"ds_name\":\"" + rrdMetric[1][0] +\
-                   "\",\n    \"cluster_name\":\"" + clusterName +\
-                   "\",\n    \"host_name\":\"" + hostName +\
-                   "\",\n    \"metric_name\":\"" + metricName + "\",\n")
-
-  firstDP = True
-  sys.stdout.write("    \"datapoints\":[\n")
-  for tuple in rrdMetric[2]:
-    if tuple[0] is not None:
-      if not firstDP:
-        sys.stdout.write(",\n")
-      firstDP = False
-      sys.stdout.write("      [")
-      sys.stdout.write(str(tuple[0]))
-      sys.stdout.write(",")
-      sys.stdout.write(str(time))
-      sys.stdout.write("]")
-    time = time + step
-  sys.stdout.write("\n    ]\n  }")
+  # ds_name
+  sys.stdout.write(rrdMetric[1][0])
+  sys.stdout.write("\n")
+
+  sys.stdout.write(clusterName)
+  sys.stdout.write("\n")
+  sys.stdout.write(hostName)
+  sys.stdout.write("\n")
+  sys.stdout.write(metricName)
+  sys.stdout.write("\n")
+
+  # write time
+  sys.stdout.write(str(rrdMetric[0][0]))
+  sys.stdout.write("\n")
+  # write step
+  sys.stdout.write(str(rrdMetric[0][2]))
+  sys.stdout.write("\n")
+
+  if not pointInTime:
+    for tuple in rrdMetric[2]:
+      if tuple[0] is not None:
+        sys.stdout.write(str(tuple[0]))
+        sys.stdout.write("\n")
+  else:
+    value = None
+    idx   = -1
+    tuple = rrdMetric[2]
+    tupleLastIdx = len(tuple) * -1
+
+    while value is None and idx >= tupleLastIdx:
+      value = tuple[idx][0]
+      idx-=1
+
+    if value is not None:
+      sys.stdout.write(str(value))
+      sys.stdout.write("\n")
+
+  sys.stdout.write("[AMBARI_DP_END]\n")
   return
 
 def stripList(l):
   return([x.strip() for x in l])
 
-sys.stdout.write("Content-type: application/json\n\n")
-
-queryString = dict(cgi.parse_qsl(os.environ['QUERY_STRING']));
+sys.stdout.write("Content-type: text/plain\n\n")
 
-sys.stdout.write("[\n")
+# write start time
+sys.stdout.write(str(time.mktime(time.gmtime())))
+sys.stdout.write("\n")
 
-firstMetric = True
+queryString = dict(cgi.parse_qsl(os.environ['QUERY_STRING']));
 
 if "m" in queryString:
   metricParts = queryString["m"].split(",")
@@ -120,6 +134,11 @@ if "cf" in queryString:
 else:
   cf = "AVERAGE"
 
+if "pt" in queryString:
+  pointInTime = True
+else:
+  pointInTime = False
+
 for cluster in clusterParts:
   for path, dirs, files in os.walk(rrdPath + cluster):
     pathParts = path.split("/")
@@ -127,12 +146,13 @@ for cluster in clusterParts:
       for file in files:
         for metric in metricParts:
           if file.endswith(metric + ".rrd"):
-            if not firstMetric:
-              sys.stdout.write(",\n")
 
-            printMetric(pathParts[-2], pathParts[-1], file[:-4], os.path.join(path, file), cf, start, end, resolution)
+            printMetric(pathParts[-2], pathParts[-1], file[:-4],
+                os.path.join(path, file), cf, start, end, resolution, pointInTime)
 
-            firstMetric = False
+sys.stdout.write("[AMBARI_END]\n")
+# write end time
+sys.stdout.write(str(time.mktime(time.gmtime())))
+sys.stdout.write("\n")
 
-sys.stdout.write("\n]\n")
 sys.stdout.flush

+ 6 - 1
ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java

@@ -147,6 +147,11 @@ public class QueryImpl implements Query {
       m_mapSubResources.putAll(m_resource.getSubResources());
     }
 
+    if (LOG.isInfoEnabled()) {
+      //todo: include predicate info.  Need to implement toString for all predicates.
+      LOG.info("Executing resource query: " + m_resource.getIds());
+    }
+
     Predicate predicate = createPredicate(m_resource);
     Iterable<Resource> iterResource = getClusterController().getResources(
         resourceType, createRequest(), predicate);
@@ -157,7 +162,7 @@ public class QueryImpl implements Query {
       // add a child node for the resource and provide a unique name.  The name is never used.
       //todo: provide a more meaningful node name
       TreeNode<Resource> node = tree.addChild(resource, resource.getType() + ":" + count++);
-       for (Map.Entry<String, ResourceInstance> entry : m_mapSubResources.entrySet()) {
+      for (Map.Entry<String, ResourceInstance> entry : m_mapSubResources.entrySet()) {
         String subResCategory = entry.getKey();
         ResourceInstance r = entry.getValue();
 

+ 2 - 2
ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceImpl.java

@@ -139,7 +139,7 @@ public class ResourceInstanceImpl implements ResourceInstance {
     ResourceInstanceImpl that = (ResourceInstanceImpl) o;
 
     return m_mapResourceIds.equals(that.m_mapResourceIds) &&
-           m_query.equals(that.m_query) &&
+           m_query == that.m_query &&
            m_resourceDefinition.equals(that.m_resourceDefinition) &&
            m_mapSubResources == null ? that.m_mapSubResources == null :
                m_mapSubResources.equals(that.m_mapSubResources);
@@ -147,7 +147,7 @@ public class ResourceInstanceImpl implements ResourceInstance {
 
   @Override
   public int hashCode() {
-    int result =m_query.hashCode();
+    int result = 13;
     result = 31 * result + m_mapResourceIds.hashCode();
     result = 31 * result + m_resourceDefinition.hashCode();
     result = 31 * result + (m_mapSubResources != null ? m_mapSubResources.hashCode() : 0);

+ 18 - 0
ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaMetric.java

@@ -152,4 +152,22 @@ public class GangliaMetric {
 
     return stringBuilder.toString();
   }
+
+  public static class TemporalMetric {
+    private Number m_value;
+    private Number m_time;
+
+    public TemporalMetric(Number value, Number time) {
+      m_value = value;
+      m_time = time;
+    }
+
+    public Number getValue() {
+      return m_value;
+    }
+
+    public Number getTime() {
+      return m_time;
+    }
+  }
 }

+ 75 - 26
ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java

@@ -22,19 +22,14 @@ import org.apache.ambari.server.controller.internal.PropertyInfo;
 import org.apache.ambari.server.controller.spi.*;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.controller.utilities.StreamProvider;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.type.TypeReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.BufferedReader;
 import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.*;
 
 /**
  * Abstract property provider implementation for a Ganglia source.
@@ -59,6 +54,7 @@ public abstract class GangliaPropertyProvider implements PropertyProvider {
   private final String componentNamePropertyId;
 
 
+
   /**
    * Map of Ganglia cluster names keyed by component type.
    */
@@ -92,7 +88,8 @@ public abstract class GangliaPropertyProvider implements PropertyProvider {
     this.hostNamePropertyId       = hostNamePropertyId;
     this.componentNamePropertyId  = componentNamePropertyId;
 
-    propertyIds = new HashSet<String>();
+    propertyIds  = new HashSet<String>();
+
     for (Map.Entry<String, Map<String, PropertyInfo>> entry : componentPropertyInfoMap.entrySet()) {
       propertyIds.addAll(entry.getValue().keySet());
     }
@@ -118,9 +115,11 @@ public abstract class GangliaPropertyProvider implements PropertyProvider {
     for (Map.Entry<String, Map<TemporalInfo, RRDRequest>> clusterEntry : requestMap.entrySet()) {
       // For each request ...
       for (RRDRequest rrdRequest : clusterEntry.getValue().values() ) {
+        //todo: property provider can reduce set of resources
         keepers.addAll(rrdRequest.populateResources());
       }
     }
+    //todo: ignoring keepers returned by the provider
     return resources;
   }
 
@@ -311,6 +310,7 @@ public abstract class GangliaPropertyProvider implements PropertyProvider {
     }
     else {
       sb.append("&e=now");
+      sb.append("&pt=true");
     }
 
     return sb.toString();
@@ -414,31 +414,76 @@ public abstract class GangliaPropertyProvider implements PropertyProvider {
     public Collection<Resource> populateResources() throws SystemException {
 
       String spec = getSpec(clusterName, clusterSet, hostSet, metrics.keySet(), temporalInfo);
-      Collection<Resource> populatedResources = new HashSet<Resource>();
-
+      BufferedReader reader = null;
       try {
-        List<GangliaMetric> gangliaMetrics = new ObjectMapper().readValue(getStreamProvider().readFrom(spec),
-            new TypeReference<List<GangliaMetric>>() {
-            });
-
-        if (gangliaMetrics != null) {
-          for (GangliaMetric gangliaMetric : gangliaMetrics) {
-
-            ResourceKey key = new ResourceKey(gangliaMetric.getHost_name(), gangliaMetric.getCluster_name());
-            Set<Resource> resourceSet = resources.get(key);
-            if (resourceSet != null) {
-              for (Resource resource : resourceSet) {
-                populateResource(resource, gangliaMetric);
-              }
+        reader = new BufferedReader(new InputStreamReader(
+            getStreamProvider().readFrom(spec)));
+
+        int startTime = convertToNumber(reader.readLine()).intValue();
+
+        String dsName = reader.readLine();
+        while(! dsName.equals("[AMBARI_END]")) {
+          GangliaMetric metric = new GangliaMetric();
+          List<GangliaMetric.TemporalMetric> listTemporalMetrics =
+              new ArrayList<GangliaMetric.TemporalMetric>();
+
+          metric.setDs_name(dsName);
+          metric.setCluster_name(reader.readLine());
+          metric.setHost_name(reader.readLine());
+          metric.setMetric_name(reader.readLine());
+
+          int time = convertToNumber(reader.readLine()).intValue();
+          int step = convertToNumber(reader.readLine()).intValue();
+
+          String val = reader.readLine();
+          while(! val.equals("[AMBARI_DP_END]")) {
+            listTemporalMetrics.add(
+                new GangliaMetric.TemporalMetric(convertToNumber(val), time));
+            time += step;
+            val = reader.readLine();
+          }
+
+          //todo: change setter in GangliaMetric to take collection
+          Number[][] datapointsArray = new Number[listTemporalMetrics.size()][2];
+          for (int i = 0; i < listTemporalMetrics.size(); ++i) {
+            GangliaMetric.TemporalMetric m = listTemporalMetrics.get(i);
+            datapointsArray[i][0] = m.getValue();
+            datapointsArray[i][1] = m.getTime();
+          }
+          metric.setDatapoints(datapointsArray);
+
+          ResourceKey key = new ResourceKey(metric.getHost_name(), metric.getCluster_name());
+          Set<Resource> resourceSet = resources.get(key);
+          if (resourceSet != null) {
+            for (Resource resource : resourceSet) {
+              populateResource(resource, metric);
             }
           }
+
+          dsName = reader.readLine();
+        }
+        int endTime = convertToNumber(reader.readLine()).intValue();
+
+        if (LOG.isInfoEnabled()) {
+          LOG.info("Ganglia resource population time: " + (endTime - startTime));
         }
       } catch (IOException e) {
         if (LOG.isErrorEnabled()) {
           LOG.error("Caught exception getting Ganglia metrics : spec=" + spec, e);
         }
+      } finally {
+        if (reader != null) {
+          try {
+            reader.close();
+          } catch (IOException e) {
+            if (LOG.isWarnEnabled()) {
+              LOG.warn("Unable to close http input steam : spec=" + spec, e);
+            }
+          }
+        }
       }
-      return populatedResources;
+      //todo: filter out resources and return keepers
+      return Collections.emptySet();
     }
 
     /**
@@ -462,6 +507,10 @@ public abstract class GangliaPropertyProvider implements PropertyProvider {
         }
       }
     }
+
+    private Number convertToNumber(String s) {
+      return s.contains(".") ? Double.parseDouble(s) : Long.parseLong(s);
+    }
   }
 
 

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXMetricHolder.java

@@ -24,7 +24,7 @@ import java.util.Map;
 /**
  *
  */
-public class JMXMetricHolder {
+public final class JMXMetricHolder {
 
   private List<Map<String, Object>> beans;
 

+ 22 - 2
ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java

@@ -22,11 +22,14 @@ import org.apache.ambari.server.controller.internal.PropertyInfo;
 import org.apache.ambari.server.controller.spi.*;
 import org.apache.ambari.server.controller.utilities.StreamProvider;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.codehaus.jackson.map.DeserializationConfig;
 import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.ObjectReader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -62,6 +65,8 @@ public class JMXPropertyProvider implements PropertyProvider {
 
   private final String componentNamePropertyId;
 
+  private final static ObjectReader objectReader;
+
 
   static {
     JMX_PORTS.put("NAMENODE",     "50070");
@@ -69,6 +74,10 @@ public class JMXPropertyProvider implements PropertyProvider {
     JMX_PORTS.put("JOBTRACKER",   "50030");
     JMX_PORTS.put("TASKTRACKER",  "50060");
     JMX_PORTS.put("HBASE_MASTER", "60010");
+
+    ObjectMapper objectMapper = new ObjectMapper();
+    objectMapper.configure(DeserializationConfig.Feature.USE_ANNOTATIONS, false);
+    objectReader = objectMapper.reader(JMXMetricHolder.class);
   }
 
   protected final static Logger LOG =
@@ -177,9 +186,10 @@ public class JMXPropertyProvider implements PropertyProvider {
     }
 
     String spec = getSpec(hostName + ":" + port);
-
+    InputStream in = null;
     try {
-      JMXMetricHolder metricHolder = new ObjectMapper().readValue(streamProvider.readFrom(spec), JMXMetricHolder.class);
+      in = streamProvider.readFrom(spec);
+      JMXMetricHolder metricHolder = objectReader.readValue(in);
 
       Map<String, Map<String, Object>> categories = new HashMap<String, Map<String, Object>>();
 
@@ -243,6 +253,16 @@ public class JMXPropertyProvider implements PropertyProvider {
       if (LOG.isErrorEnabled()) {
         LOG.error("Caught exception getting JMX metrics : spec=" + spec, e);
       }
+    } finally {
+      if (in != null) {
+        try {
+          in.close();
+        } catch (IOException e) {
+          if (LOG.isWarnEnabled()) {
+            LOG.warn("Unable to close http input steam : spec=" + spec, e);
+          }
+        }
+      }
     }
 
     return true;

+ 1 - 1
ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/TestStreamProvider.java

@@ -30,7 +30,7 @@ public class TestStreamProvider implements StreamProvider {
   @Override
   public InputStream readFrom(String spec) throws IOException {
     lastSpec = spec;
-    return ClassLoader.getSystemResourceAsStream("temporal_ganglia.json");
+    return ClassLoader.getSystemResourceAsStream("temporal_ganglia_data.txt");
   }
 
   public String getLastSpec() {

+ 0 - 752
ambari-server/src/test/resources/temporal_ganglia.json

@@ -1,752 +0,0 @@
-[
-  {
-    "ds_name":"sum",
-    "cluster_name":"HDPSlaves",
-    "graph_type":"stack",
-    "host_name":"domU-12-31-39-0E-34-E1.compute-1.internal",
-    "metric_name":"jvm.metrics.gcCount",
-    "datapoints":[
-      [0, 1349899845],
-      [0, 1349899860],
-      [0, 1349899875],
-      [0, 1349899890],
-      [0, 1349899905],
-      [0, 1349899920],
-      [0, 1349899935],
-      [0, 1349899950],
-      [0, 1349899965],
-      [0, 1349899980],
-      [0, 1349899995],
-      [0, 1349900010],
-      [0, 1349900025],
-      [0, 1349900040],
-      [0, 1349900055],
-      [0, 1349900070],
-      [0, 1349900085],
-      [0, 1349900100],
-      [0, 1349900115],
-      [0, 1349900130],
-      [0, 1349900145],
-      [0, 1349900160],
-      [0, 1349900175],
-      [0, 1349900190],
-      [0, 1349900205],
-      [0, 1349900220],
-      [0, 1349900235],
-      [0, 1349900250],
-      [0, 1349900265],
-      [0, 1349900280],
-      [0, 1349900295],
-      [0, 1349900310],
-      [0, 1349900325],
-      [0, 1349900340],
-      [0, 1349900355],
-      [0, 1349900370],
-      [0, 1349900385],
-      [0, 1349900400],
-      [0, 1349900415],
-      [0, 1349900430],
-      [0, 1349900445],
-      [0, 1349900460],
-      [0, 1349900475],
-      [0, 1349900490],
-      [0, 1349900505],
-      [0, 1349900520],
-      [0, 1349900535],
-      [0, 1349900550],
-      [0, 1349900565],
-      [0, 1349900580],
-      [0, 1349900595],
-      [0, 1349900610],
-      [0, 1349900625],
-      [0, 1349900640],
-      [0, 1349900655],
-      [0, 1349900670],
-      [0, 1349900685],
-      [0, 1349900700],
-      [0, 1349900715],
-      [0, 1349900730],
-      [0, 1349900745],
-      [0, 1349900760],
-      [0, 1349900775],
-      [0, 1349900790],
-      [0, 1349900805],
-      [0, 1349900820],
-      [0, 1349900835],
-      [0, 1349900850],
-      [0, 1349900865],
-      [0, 1349900880],
-      [0, 1349900895],
-      [0, 1349900910],
-      [0, 1349900925],
-      [0, 1349900940],
-      [0, 1349900955],
-      [0, 1349900970],
-      [0, 1349900985],
-      [0, 1349901000],
-      [0, 1349901015],
-      [0, 1349901030],
-      [0, 1349901045],
-      [0, 1349901060],
-      [0, 1349901075],
-      [0, 1349901090],
-      [0, 1349901105],
-      [0, 1349901120],
-      [0, 1349901135],
-      [0, 1349901150],
-      [0, 1349901165],
-      [0, 1349901180],
-      [0, 1349901195],
-      [0, 1349901210],
-      [0, 1349901225],
-      [0, 1349901240],
-      [0, 1349901255],
-      [0, 1349901270],
-      [0, 1349901285],
-      [0, 1349901300],
-      [0, 1349901315],
-      [0, 1349901330],
-      [0, 1349901345],
-      [0, 1349901360],
-      [1.85333333, 1349901375],
-      [12.0466667, 1349901390],
-      [0, 1349901405],
-      [0, 1349901420],
-      [0, 1349901435],
-      [0, 1349901450],
-      [0, 1349901465],
-      [0, 1349901480],
-      [0, 1349901495],
-      [0, 1349901510],
-      [0, 1349901525],
-      [0, 1349901540],
-      [0, 1349901555],
-      [0, 1349901570],
-      [0, 1349901585],
-      [0, 1349901600],
-      [0, 1349901615],
-      [0, 1349901630],
-      [0, 1349901645],
-      [0, 1349901660],
-      [0, 1349901675],
-      [0, 1349901690],
-      [0, 1349901705],
-      [0, 1349901720],
-      [0, 1349901735],
-      [0, 1349901750],
-      [0, 1349901765],
-      [0, 1349901780],
-      [0, 1349901795],
-      [0, 1349901810],
-      [0, 1349901825],
-      [0, 1349901840],
-      [0, 1349901855],
-      [0, 1349901870],
-      [0, 1349901885],
-      [0, 1349901900],
-      [0, 1349901915],
-      [0, 1349901930],
-      [0, 1349901945],
-      [0, 1349901960],
-      [0, 1349901975],
-      [0, 1349901990],
-      [0, 1349902005],
-      [0, 1349902020],
-      [0, 1349902035],
-      [0, 1349902050],
-      [0, 1349902065],
-      [0, 1349902080],
-      [0, 1349902095],
-      [0, 1349902110],
-      [0, 1349902125],
-      [0, 1349902140],
-      [0, 1349902155],
-      [0, 1349902170],
-      [0, 1349902185],
-      [0, 1349902200],
-      [0, 1349902215],
-      [0, 1349902230],
-      [0, 1349902245],
-      [0, 1349902260],
-      [0, 1349902275],
-      [0, 1349902290],
-      [0, 1349902305],
-      [0, 1349902320],
-      [0, 1349902335],
-      [0, 1349902350],
-      [0, 1349902365],
-      [0, 1349902380],
-      [0, 1349902395],
-      [0, 1349902410],
-      [0, 1349902425],
-      [0, 1349902440],
-      [0, 1349902455],
-      [0, 1349902470],
-      [0, 1349902485],
-      [0, 1349902500],
-      [0, 1349902515],
-      [0, 1349902530],
-      [0, 1349902545],
-      [0, 1349902560],
-      [0, 1349902575],
-      [0, 1349902590],
-      [0, 1349902605],
-      [0, 1349902620],
-      [0, 1349902635],
-      [0, 1349902650],
-      [0, 1349902665],
-      [0, 1349902680],
-      [0, 1349902695],
-      [0, 1349902710],
-      [0, 1349902725],
-      [0, 1349902740],
-      [0, 1349902755],
-      [0, 1349902770],
-      [0, 1349902785],
-      [0, 1349902800],
-      [0, 1349902815],
-      [0, 1349902830],
-      [0, 1349902845],
-      [0, 1349902860],
-      [0, 1349902875],
-      [0, 1349902890],
-      [0, 1349902905],
-      [0, 1349902920],
-      [0, 1349902935],
-      [0, 1349902950],
-      [0, 1349902965],
-      [0, 1349902980],
-      [0, 1349902995],
-      [0, 1349903010],
-      [0, 1349903025],
-      [0, 1349903040],
-      [0, 1349903055],
-      [0, 1349903070],
-      [0, 1349903085],
-      [0, 1349903100],
-      [0, 1349903115],
-      [0, 1349903130],
-      [0, 1349903145],
-      [0, 1349903160],
-      [0, 1349903175],
-      [0, 1349903190],
-      [0, 1349903205],
-      [0, 1349903220],
-      [0, 1349903235],
-      [0, 1349903250],
-      [0, 1349903265],
-      [0, 1349903280],
-      [0, 1349903295],
-      [0, 1349903310],
-      [0, 1349903325],
-      [0, 1349903340],
-      [0, 1349903355],
-      [0, 1349903370],
-      [0, 1349903385],
-      [0, 1349903400],
-      [0, 1349903415],
-      [0, 1349903430],
-      [0, 1349903445]
-    ]
-  },
-  {
-    "ds_name":"sum",
-    "cluster_name":"HDPSlaves",
-    "graph_type":"stack",
-    "host_name":"domU-12-31-39-0E-34-E2.compute-1.internal",
-    "metric_name":"jvm.metrics.gcCount",
-    "datapoints":[
-      [0, 1349899845],
-      [0, 1349899860],
-      [0, 1349899875],
-      [0, 1349899890],
-      [0, 1349899905],
-      [0, 1349899920],
-      [0, 1349899935],
-      [0, 1349899950],
-      [0, 1349899965],
-      [0, 1349899980],
-      [0, 1349899995],
-      [0, 1349900010],
-      [0, 1349900025],
-      [0, 1349900040],
-      [0, 1349900055],
-      [0, 1349900070],
-      [0, 1349900085],
-      [0, 1349900100],
-      [0, 1349900115],
-      [0, 1349900130],
-      [0, 1349900145],
-      [0, 1349900160],
-      [0, 1349900175],
-      [0, 1349900190],
-      [0, 1349900205],
-      [0, 1349900220],
-      [0, 1349900235],
-      [0, 1349900250],
-      [0, 1349900265],
-      [0, 1349900280],
-      [0, 1349900295],
-      [0, 1349900310],
-      [0, 1349900325],
-      [0, 1349900340],
-      [0, 1349900355],
-      [0, 1349900370],
-      [0, 1349900385],
-      [0, 1349900400],
-      [0, 1349900415],
-      [0, 1349900430],
-      [0, 1349900445],
-      [0, 1349900460],
-      [0, 1349900475],
-      [0, 1349900490],
-      [0, 1349900505],
-      [0, 1349900520],
-      [0, 1349900535],
-      [0, 1349900550],
-      [0, 1349900565],
-      [0, 1349900580],
-      [0, 1349900595],
-      [0, 1349900610],
-      [0, 1349900625],
-      [0, 1349900640],
-      [0, 1349900655],
-      [0, 1349900670],
-      [0, 1349900685],
-      [0, 1349900700],
-      [0, 1349900715],
-      [0, 1349900730],
-      [0, 1349900745],
-      [0, 1349900760],
-      [0, 1349900775],
-      [0, 1349900790],
-      [0, 1349900805],
-      [0, 1349900820],
-      [0, 1349900835],
-      [0, 1349900850],
-      [0, 1349900865],
-      [0, 1349900880],
-      [0, 1349900895],
-      [0, 1349900910],
-      [0, 1349900925],
-      [0, 1349900940],
-      [0, 1349900955],
-      [0, 1349900970],
-      [0, 1349900985],
-      [0, 1349901000],
-      [0, 1349901015],
-      [0, 1349901030],
-      [0, 1349901045],
-      [0, 1349901060],
-      [0, 1349901075],
-      [0, 1349901090],
-      [0, 1349901105],
-      [0, 1349901120],
-      [0, 1349901135],
-      [0, 1349901150],
-      [0, 1349901165],
-      [0, 1349901180],
-      [0, 1349901195],
-      [0, 1349901210],
-      [0, 1349901225],
-      [0, 1349901240],
-      [0, 1349901255],
-      [0, 1349901270],
-      [0, 1349901285],
-      [0, 1349901300],
-      [0, 1349901315],
-      [0, 1349901330],
-      [0, 1349901345],
-      [0, 1349901360],
-      [1.85333333, 1349901375],
-      [12.0466667, 1349901390],
-      [0, 1349901405],
-      [0, 1349901420],
-      [0, 1349901435],
-      [0, 1349901450],
-      [0, 1349901465],
-      [0, 1349901480],
-      [0, 1349901495],
-      [0, 1349901510],
-      [0, 1349901525],
-      [0, 1349901540],
-      [0, 1349901555],
-      [0, 1349901570],
-      [0, 1349901585],
-      [0, 1349901600],
-      [0, 1349901615],
-      [0, 1349901630],
-      [0, 1349901645],
-      [0, 1349901660],
-      [0, 1349901675],
-      [0, 1349901690],
-      [0, 1349901705],
-      [0, 1349901720],
-      [0, 1349901735],
-      [0, 1349901750],
-      [0, 1349901765],
-      [0, 1349901780],
-      [0, 1349901795],
-      [0, 1349901810],
-      [0, 1349901825],
-      [0, 1349901840],
-      [0, 1349901855],
-      [0, 1349901870],
-      [0, 1349901885],
-      [0, 1349901900],
-      [0, 1349901915],
-      [0, 1349901930],
-      [0, 1349901945],
-      [0, 1349901960],
-      [0, 1349901975],
-      [0, 1349901990],
-      [0, 1349902005],
-      [0, 1349902020],
-      [0, 1349902035],
-      [0, 1349902050],
-      [0, 1349902065],
-      [0, 1349902080],
-      [0, 1349902095],
-      [0, 1349902110],
-      [0, 1349902125],
-      [0, 1349902140],
-      [0, 1349902155],
-      [0, 1349902170],
-      [0, 1349902185],
-      [0, 1349902200],
-      [0, 1349902215],
-      [0, 1349902230],
-      [0, 1349902245],
-      [0, 1349902260],
-      [0, 1349902275],
-      [0, 1349902290],
-      [0, 1349902305],
-      [0, 1349902320],
-      [0, 1349902335],
-      [0, 1349902350],
-      [0, 1349902365],
-      [0, 1349902380],
-      [0, 1349902395],
-      [0, 1349902410],
-      [0, 1349902425],
-      [0, 1349902440],
-      [0, 1349902455],
-      [0, 1349902470],
-      [0, 1349902485],
-      [0, 1349902500],
-      [0, 1349902515],
-      [0, 1349902530],
-      [0, 1349902545],
-      [0, 1349902560],
-      [0, 1349902575],
-      [0, 1349902590],
-      [0, 1349902605],
-      [0, 1349902620],
-      [0, 1349902635],
-      [0, 1349902650],
-      [0, 1349902665],
-      [0, 1349902680],
-      [0, 1349902695],
-      [0, 1349902710],
-      [0, 1349902725],
-      [0, 1349902740],
-      [0, 1349902755],
-      [0, 1349902770],
-      [0, 1349902785],
-      [0, 1349902800],
-      [0, 1349902815],
-      [0, 1349902830],
-      [0, 1349902845],
-      [0, 1349902860],
-      [0, 1349902875],
-      [0, 1349902890],
-      [0, 1349902905],
-      [0, 1349902920],
-      [0, 1349902935],
-      [0, 1349902950],
-      [0, 1349902965],
-      [0, 1349902980],
-      [0, 1349902995],
-      [0, 1349903010],
-      [0, 1349903025],
-      [0, 1349903040],
-      [0, 1349903055],
-      [0, 1349903070],
-      [0, 1349903085],
-      [0, 1349903100],
-      [0, 1349903115],
-      [0, 1349903130],
-      [0, 1349903145],
-      [0, 1349903160],
-      [0, 1349903175],
-      [0, 1349903190],
-      [0, 1349903205],
-      [0, 1349903220],
-      [0, 1349903235],
-      [0, 1349903250],
-      [0, 1349903265],
-      [0, 1349903280],
-      [0, 1349903295],
-      [0, 1349903310],
-      [0, 1349903325],
-      [0, 1349903340],
-      [0, 1349903355],
-      [0, 1349903370],
-      [0, 1349903385],
-      [0, 1349903400],
-      [0, 1349903415],
-      [0, 1349903430],
-      [0, 1349903445]
-    ]
-  },
-  {
-    "ds_name":"sum",
-    "cluster_name":"HDPSlaves",
-    "graph_type":"stack",
-    "host_name":"domU-12-31-39-0E-34-E3.compute-1.internal",
-    "metric_name":"jvm.metrics.gcCount",
-    "datapoints":[
-      [0, 1349899845],
-      [0, 1349899860],
-      [0, 1349899875],
-      [0, 1349899890],
-      [0, 1349899905],
-      [0, 1349899920],
-      [0, 1349899935],
-      [0, 1349899950],
-      [0, 1349899965],
-      [0, 1349899980],
-      [0, 1349899995],
-      [0, 1349900010],
-      [0, 1349900025],
-      [0, 1349900040],
-      [0, 1349900055],
-      [0, 1349900070],
-      [0, 1349900085],
-      [0, 1349900100],
-      [0, 1349900115],
-      [0, 1349900130],
-      [0, 1349900145],
-      [0, 1349900160],
-      [0, 1349900175],
-      [0, 1349900190],
-      [0, 1349900205],
-      [0, 1349900220],
-      [0, 1349900235],
-      [0, 1349900250],
-      [0, 1349900265],
-      [0, 1349900280],
-      [0, 1349900295],
-      [0, 1349900310],
-      [0, 1349900325],
-      [0, 1349900340],
-      [0, 1349900355],
-      [0, 1349900370],
-      [0, 1349900385],
-      [0, 1349900400],
-      [0, 1349900415],
-      [0, 1349900430],
-      [0, 1349900445],
-      [0, 1349900460],
-      [0, 1349900475],
-      [0, 1349900490],
-      [0, 1349900505],
-      [0, 1349900520],
-      [0, 1349900535],
-      [0, 1349900550],
-      [0, 1349900565],
-      [0, 1349900580],
-      [0, 1349900595],
-      [0, 1349900610],
-      [0, 1349900625],
-      [0, 1349900640],
-      [0, 1349900655],
-      [0, 1349900670],
-      [0, 1349900685],
-      [0, 1349900700],
-      [0, 1349900715],
-      [0, 1349900730],
-      [0, 1349900745],
-      [0, 1349900760],
-      [0, 1349900775],
-      [0, 1349900790],
-      [0, 1349900805],
-      [0, 1349900820],
-      [0, 1349900835],
-      [0, 1349900850],
-      [0, 1349900865],
-      [0, 1349900880],
-      [0, 1349900895],
-      [0, 1349900910],
-      [0, 1349900925],
-      [0, 1349900940],
-      [0, 1349900955],
-      [0, 1349900970],
-      [0, 1349900985],
-      [0, 1349901000],
-      [0, 1349901015],
-      [0, 1349901030],
-      [0, 1349901045],
-      [0, 1349901060],
-      [0, 1349901075],
-      [0, 1349901090],
-      [0, 1349901105],
-      [0, 1349901120],
-      [0, 1349901135],
-      [0, 1349901150],
-      [0, 1349901165],
-      [0, 1349901180],
-      [0, 1349901195],
-      [0, 1349901210],
-      [0, 1349901225],
-      [0, 1349901240],
-      [0, 1349901255],
-      [0, 1349901270],
-      [0, 1349901285],
-      [0, 1349901300],
-      [0, 1349901315],
-      [0, 1349901330],
-      [0, 1349901345],
-      [0, 1349901360],
-      [1.85333333, 1349901375],
-      [12.0466667, 1349901390],
-      [0, 1349901405],
-      [0, 1349901420],
-      [0, 1349901435],
-      [0, 1349901450],
-      [0, 1349901465],
-      [0, 1349901480],
-      [0, 1349901495],
-      [0, 1349901510],
-      [0, 1349901525],
-      [0, 1349901540],
-      [0, 1349901555],
-      [0, 1349901570],
-      [0, 1349901585],
-      [0, 1349901600],
-      [0, 1349901615],
-      [0, 1349901630],
-      [0, 1349901645],
-      [0, 1349901660],
-      [0, 1349901675],
-      [0, 1349901690],
-      [0, 1349901705],
-      [0, 1349901720],
-      [0, 1349901735],
-      [0, 1349901750],
-      [0, 1349901765],
-      [0, 1349901780],
-      [0, 1349901795],
-      [0, 1349901810],
-      [0, 1349901825],
-      [0, 1349901840],
-      [0, 1349901855],
-      [0, 1349901870],
-      [0, 1349901885],
-      [0, 1349901900],
-      [0, 1349901915],
-      [0, 1349901930],
-      [0, 1349901945],
-      [0, 1349901960],
-      [0, 1349901975],
-      [0, 1349901990],
-      [0, 1349902005],
-      [0, 1349902020],
-      [0, 1349902035],
-      [0, 1349902050],
-      [0, 1349902065],
-      [0, 1349902080],
-      [0, 1349902095],
-      [0, 1349902110],
-      [0, 1349902125],
-      [0, 1349902140],
-      [0, 1349902155],
-      [0, 1349902170],
-      [0, 1349902185],
-      [0, 1349902200],
-      [0, 1349902215],
-      [0, 1349902230],
-      [0, 1349902245],
-      [0, 1349902260],
-      [0, 1349902275],
-      [0, 1349902290],
-      [0, 1349902305],
-      [0, 1349902320],
-      [0, 1349902335],
-      [0, 1349902350],
-      [0, 1349902365],
-      [0, 1349902380],
-      [0, 1349902395],
-      [0, 1349902410],
-      [0, 1349902425],
-      [0, 1349902440],
-      [0, 1349902455],
-      [0, 1349902470],
-      [0, 1349902485],
-      [0, 1349902500],
-      [0, 1349902515],
-      [0, 1349902530],
-      [0, 1349902545],
-      [0, 1349902560],
-      [0, 1349902575],
-      [0, 1349902590],
-      [0, 1349902605],
-      [0, 1349902620],
-      [0, 1349902635],
-      [0, 1349902650],
-      [0, 1349902665],
-      [0, 1349902680],
-      [0, 1349902695],
-      [0, 1349902710],
-      [0, 1349902725],
-      [0, 1349902740],
-      [0, 1349902755],
-      [0, 1349902770],
-      [0, 1349902785],
-      [0, 1349902800],
-      [0, 1349902815],
-      [0, 1349902830],
-      [0, 1349902845],
-      [0, 1349902860],
-      [0, 1349902875],
-      [0, 1349902890],
-      [0, 1349902905],
-      [0, 1349902920],
-      [0, 1349902935],
-      [0, 1349902950],
-      [0, 1349902965],
-      [0, 1349902980],
-      [0, 1349902995],
-      [0, 1349903010],
-      [0, 1349903025],
-      [0, 1349903040],
-      [0, 1349903055],
-      [0, 1349903070],
-      [0, 1349903085],
-      [0, 1349903100],
-      [0, 1349903115],
-      [0, 1349903130],
-      [0, 1349903145],
-      [0, 1349903160],
-      [0, 1349903175],
-      [0, 1349903190],
-      [0, 1349903205],
-      [0, 1349903220],
-      [0, 1349903235],
-      [0, 1349903250],
-      [0, 1349903265],
-      [0, 1349903280],
-      [0, 1349903295],
-      [0, 1349903310],
-      [0, 1349903325],
-      [0, 1349903340],
-      [0, 1349903355],
-      [0, 1349903370],
-      [0, 1349903385],
-      [0, 1349903400],
-      [0, 1349903415],
-      [0, 1349903430],
-      [0, 1349903445]
-    ]
-  }
-]

+ 747 - 0
ambari-server/src/test/resources/temporal_ganglia_data.txt

@@ -0,0 +1,747 @@
+1111111111
+sum
+HDPSlaves
+domU-12-31-39-0E-34-E1.compute-1.internal
+jvm.metrics.gcCount
+1349899845
+15
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1.85333333
+12.0466667
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+[AMBARI_DP_END]
+sum
+HDPSlaves
+domU-12-31-39-0E-34-E2.compute-1.internal
+jvm.metrics.gcCount
+1349899845
+15
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1.85333333
+12.0466667
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+[AMBARI_DP_END]
+sum
+HDPSlaves
+domU-12-31-39-0E-34-E3.compute-1.internal
+jvm.metrics.gcCount
+1349899845
+15
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1.85333333
+12.0466667
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+[AMBARI_DP_END]
+[AMBARI_END]
+999999999