ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fba...@apache.org
Subject ambari git commit: AMBARI-8994 AMS : Yarn service - RPC metrics returns duplicate array elements.
Date Sat, 28 Feb 2015 00:14:16 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 812656756 -> b1dccde13


AMBARI-8994 AMS : Yarn service - RPC metrics returns duplicate array elements.

Implemented proper downsampling algorithm. Fixed test data to reflect real production scenarios.


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b1dccde1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b1dccde1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b1dccde1

Branch: refs/heads/trunk
Commit: b1dccde13efabd2c06575d76cd02f05e60366893
Parents: 8126567
Author: Florian Barca <fbarca@hortonworks.com>
Authored: Fri Feb 27 16:10:22 2015 -0800
Committer: Florian Barca <fbarca@hortonworks.com>
Committed: Fri Feb 27 16:14:04 2015 -0800

----------------------------------------------------------------------
 .../internal/AbstractPropertyProvider.java      |  36 +-
 .../metrics/MetricReportingAdapter.java         |  34 ++
 .../metrics/MetricsDataTransferMethod.java      |  22 ++
 .../MetricsDataTransferMethodFactory.java       |  66 ++++
 .../metrics/MetricsDownsamplingMethod.java      |  24 ++
 .../MetricsDownsamplingMethodFactory.java       | 114 ++++++
 .../timeline/AMSPropertyProviderTest.java       |   4 +-
 .../resources/ams/multiple_host_metrics.json    | 395 ++++++++++---------
 .../test/resources/ams/single_host_metric.json  | 223 +++++------
 9 files changed, 576 insertions(+), 342 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b1dccde1/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java
index abd242e..3d88dda 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java
@@ -31,10 +31,10 @@ import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.ambari.server.controller.metrics.MetricReportingAdapter;
 import org.apache.ambari.server.controller.spi.PropertyProvider;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
-import org.apache.http.client.utils.URIBuilder;
 
 /**
  *  Abstract property provider implementation.
@@ -69,20 +69,8 @@ public abstract class AbstractPropertyProvider extends BaseProvider implements
P
    */
   private static final String FIND_REGEX_IN_METRIC_REGEX = "\\([^)]+\\)";
 
-  private static final Set<String> PERCENTAGE_METRIC;
   private static final DecimalFormat decimalFormat = new DecimalFormat("#.00");
 
-  static {
-    Set<String> temp = new HashSet<String>();
-    temp.add("cpu_wio");
-    temp.add("cpu_idle");
-    temp.add("cpu_nice");
-    temp.add("cpu_aidle");
-    temp.add("cpu_system");
-    temp.add("cpu_user");
-    PERCENTAGE_METRIC = Collections.unmodifiableSet(temp);
-  }
-
   // ----- Constructors ------------------------------------------------------
 
   /**
@@ -369,26 +357,10 @@ public abstract class AbstractPropertyProvider extends BaseProvider
implements P
 
   // Normalize percent values: Copied over from Ganglia Metric
   private static Number[][] getGangliaLikeDatapoints(TimelineMetric metric) {
-    Number[][] datapointsArray = new Number[metric.getMetricValues().size()][2];
-    int cnt = 0;
-
-    for (Map.Entry<Long, Double> metricEntry : metric.getMetricValues().entrySet())
{
-      Double value = metricEntry.getValue();
-      Long time = metricEntry.getKey();
-      if (time > 9999999999l) {
-        time = time / 1000;
-      }
-
-      if (PERCENTAGE_METRIC.contains(metric.getMetricName())) {
-        value = new Double(decimalFormat.format(value / 100));
-      }
-
-      datapointsArray[cnt][0] = value;
-      datapointsArray[cnt][1] = time;
-      cnt++;
-    }
+    MetricReportingAdapter rpt = new MetricReportingAdapter(metric);
 
-    return datapointsArray;
+    //TODO Don't we always need to downsample?
+    return rpt.reportMetricData(metric);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1dccde1/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricReportingAdapter.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricReportingAdapter.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricReportingAdapter.java
new file mode 100644
index 0000000..d015097
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricReportingAdapter.java
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller.metrics;
+
+import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
+
+public class MetricReportingAdapter {
+  private MetricsDownsamplingMethod downsamplingMethod;
+  private MetricsDataTransferMethod dataTransferMethod;
+
+  public MetricReportingAdapter(TimelineMetric metricDecl) {
+    downsamplingMethod = MetricsDownsamplingMethodFactory.detectDownsamplingMethod(metricDecl);
+    dataTransferMethod = MetricsDataTransferMethodFactory.detectDataTransferMethod(metricDecl);
+  }
+
+  public Number[][] reportMetricData(TimelineMetric metricData) {
+    return downsamplingMethod.reportMetricData(metricData, dataTransferMethod);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1dccde1/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDataTransferMethod.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDataTransferMethod.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDataTransferMethod.java
new file mode 100644
index 0000000..004742e
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDataTransferMethod.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller.metrics;
+
+public abstract class MetricsDataTransferMethod {
+  public abstract Double getData(Double data);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1dccde1/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDataTransferMethodFactory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDataTransferMethodFactory.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDataTransferMethodFactory.java
new file mode 100644
index 0000000..3c683c8
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDataTransferMethodFactory.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller.metrics;
+
+import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+public class MetricsDataTransferMethodFactory {
+  private static final Set<String> PERCENTAGE_METRIC;
+
+  static {
+    Set<String> temp = new HashSet<String>();
+    temp.add("cpu_wio");
+    temp.add("cpu_idle");
+    temp.add("cpu_nice");
+    temp.add("cpu_aidle");
+    temp.add("cpu_system");
+    temp.add("cpu_user");
+    PERCENTAGE_METRIC = Collections.unmodifiableSet(temp);
+  }
+
+  private static final MetricsDataTransferMethod percentageAdjustment = new PercentageAdjustmentTransferMethod();
+  private static final MetricsDataTransferMethod passThrough = new PassThroughTransferMethod();
+
+  public static MetricsDataTransferMethod detectDataTransferMethod(TimelineMetric metricDecl)
{
+    if (PERCENTAGE_METRIC.contains(metricDecl.getMetricName())) {
+      return percentageAdjustment;
+    } else {
+      return passThrough;
+    }
+  }
+}
+
+class PercentageAdjustmentTransferMethod extends MetricsDataTransferMethod {
+
+  @Override
+  public Double getData(Double data) {
+    return new Double(data / 100);
+  }
+}
+
+class PassThroughTransferMethod extends MetricsDataTransferMethod {
+
+  @Override
+  public Double getData(Double data) {
+    return data;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1dccde1/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDownsamplingMethod.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDownsamplingMethod.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDownsamplingMethod.java
new file mode 100644
index 0000000..8e96a42
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDownsamplingMethod.java
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller.metrics;
+
+import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
+
+public abstract class MetricsDownsamplingMethod {
+  public abstract Number[][] reportMetricData(TimelineMetric metricData, MetricsDataTransferMethod
dataTransferMethod);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1dccde1/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDownsamplingMethodFactory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDownsamplingMethodFactory.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDownsamplingMethodFactory.java
new file mode 100644
index 0000000..a53e26d
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDownsamplingMethodFactory.java
@@ -0,0 +1,114 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller.metrics;
+
+import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+
+public class MetricsDownsamplingMethodFactory {
+  private static final MetricsDownsamplingMethod perSecondDownsampling = new MetricsAveragePerSecondDownsampling();
+  private static final MetricsDownsamplingMethod noDownsampling = new MetricNoDownsampling();
+
+  public static MetricsDownsamplingMethod detectDownsamplingMethod(TimelineMetric metricDecl)
{
+    if (mustDownsample(metricDecl)) {
+      return perSecondDownsampling;
+    } else {
+      return noDownsampling;
+    }
+  }
+
+  private static boolean mustDownsample(TimelineMetric metric) {
+    //Linear search in Map<K, V>, faster than copying the map in a TreeMap and doing
ceilingEntry()
+    for (Long time : metric.getMetricValues().keySet()) {
+      if (time > 9999999999l)
+        return true;
+    }
+    return false;
+  }
+}
+
+class MetricNoDownsampling extends MetricsDownsamplingMethod {
+  @Override
+  public Number[][] reportMetricData(TimelineMetric metricData, MetricsDataTransferMethod
dataTransferMethod) {
+    Number[][] datapointsArray = new Number[metricData.getMetricValues().size()][2];
+    int cnt = 0;
+
+    for (Map.Entry<Long, Double> metricEntry : metricData.getMetricValues().entrySet())
{
+      datapointsArray[cnt][0] = dataTransferMethod.getData(metricEntry.getValue());
+      datapointsArray[cnt][1] = metricEntry.getKey();
+      cnt++;
+    }
+
+    return datapointsArray;
+  }
+}
+
+class MetricsAveragePerSecondDownsampling extends MetricsDownsamplingMethod {
+  class Accumulo {
+    public long ts;
+    public double val;
+
+    public Accumulo(long t, double v) {
+      this.ts = t;
+      this.val = v;
+    }
+  }
+  @Override
+  public Number[][] reportMetricData(TimelineMetric metricData, MetricsDataTransferMethod
dataTransferMethod) {
+    ArrayList<Accumulo> cache = new ArrayList<Accumulo>();
+
+    final Iterator<Map.Entry<Long, Double>> ci = metricData.getMetricValues().entrySet().iterator();
+    if (ci.hasNext()) {
+      Map.Entry<Long, Double> e0 = ci.next();
+      long t0 = e0.getKey() / 1000;
+      double s0 = e0.getValue();
+      int nSamples = 1;
+
+      while(ci.hasNext()) {
+        e0 = ci.next();
+        long t = e0.getKey() / 1000;
+
+        if (t != t0) {
+          cache.add(new Accumulo(t0, dataTransferMethod.getData(s0 / nSamples)));
+          t0 = t;
+          s0 = e0.getValue();
+          nSamples = 1;
+        } else {
+          s0 += e0.getValue();
+          nSamples++;
+        }
+      }
+
+      //Add the last entry into the cache
+      cache.add(new Accumulo(t0, dataTransferMethod.getData(s0 / nSamples)));
+    }
+
+    Number[][] datapointsArray = new Number[cache.size()][2];
+    int cnt = 0;
+    for (Accumulo e : cache) {
+      datapointsArray[cnt][0] = e.val;
+      datapointsArray[cnt][1] = e.ts;
+      cnt++;
+    }
+
+    return datapointsArray;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1dccde1/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
index d8e0b65..4e2ed98 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
@@ -137,7 +137,7 @@ public class AMSPropertyProviderTest {
     uriBuilder.addParameter("appId", "HOST");
     Assert.assertEquals(uriBuilder.toString(), streamProvider.getLastSpec());
     Double val = (Double) res.getPropertyValue(PROPERTY_ID1);
-    Assert.assertEquals(40.45, val, 0.001);
+    Assert.assertEquals(41.088, val, 0.001);
   }
 
   @Test
@@ -180,7 +180,7 @@ public class AMSPropertyProviderTest {
     Assert.assertTrue(uriBuilder.toString().equals(streamProvider.getLastSpec())
         || uriBuilder2.toString().equals(streamProvider.getLastSpec()));
     Double val1 = (Double) res.getPropertyValue(PROPERTY_ID1);
-    Assert.assertEquals(40.45, val1, 0.001);
+    Assert.assertEquals(41.088, val1, 0.001);
     Double val2 = (Double)res.getPropertyValue(PROPERTY_ID2);
     Assert.assertEquals(2.47025664E8, val2, 0.1);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1dccde1/ambari-server/src/test/resources/ams/multiple_host_metrics.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/ams/multiple_host_metrics.json b/ambari-server/src/test/resources/ams/multiple_host_metrics.json
index 98d821a..019dc62 100644
--- a/ambari-server/src/test/resources/ams/multiple_host_metrics.json
+++ b/ambari-server/src/test/resources/ams/multiple_host_metrics.json
@@ -5,117 +5,118 @@
         "appid": "HOST",
         "starttime": 1416445244801,
         "metrics": {
-            "1416446384801": 4027.0550000000003,
-            "1416445244801": 4006.085,
-            "1416448711363": 4105.6875,
-            "1416446744801": 4032.82,
-            "1416446969801": 4036.255,
-            "1416445544801": 4011.4975000000004,
-            "1416446849801": 4034.4725,
-            "1416446024801": 4020.96,
-            "1416445979801": 4020.2975,
-            "1416448921363": 4109.2625,
-            "1416446144801": 4022.98,
-            "1416447569801": 4046.865,
-            "1416445394801": 4008.37,
-            "1416445319801": 4007.21,
-            "1416445484801": 4009.9525,
-            "1416446939801": 4035.7175,
-            "1416447419801": 4044.52,
-            "1416447464801": 4045.325,
-            "1416445634801": 4013.3424999999997,
-            "1416447299801": 4041.85,
-            "1416446459801": 4028.2799999999997,
-            "1416446804801": 4033.7475,
-            "1416446099801": 4022.2,
-            "1416447074801": 4038.2025,
-            "1416446699801": 4032.0175,
-            "1416446819801": 4033.9700000000003,
-            "1416446249801": 4024.925,
-            "1416445724801": 4015.73,
-            "1416446579801": 4030.1800000000003,
-            "1416445379801": 4008.0425000000005,
-            "1416447284801": 4041.51,
-            "1416446114801": 4022.3775,
-            "1416447179801": 4039.9025,
-            "1416448861363": 4107.545,
-            "1416448801363": 4106.74,
-            "1416446834801": 4034.1425,
-            "1416448741363": 4105.9574999999995,
-            "1416445259801": 4006.29,
-            "1416445499801": 4010.19,
-            "1416446474801": 4028.4275,
-            "1416448936363": 4109.4,
-            "1416445529801": 4011.3424999999997,
-            "1416447554801": 4046.55,
-            "1416446684801": 4031.7825,
-            "1416445424801": 4009.08,
-            "1416447584801": 4047.0550000000003,
-            "1416447434801": 4044.705,
-            "1416446084801": 4021.9725,
-            "1416446504801": 4028.98,
-            "1416446354801": 4026.5275,
-            "1416446339801": 4026.4125,
-            "1416445619801": 4012.9325,
-            "1416447059801": 4038.045,
-            "1416447089801": 4038.7,
-            "1416445304801": 4007.1025,
-            "1416445649801": 4013.9225,
-            "1416446204801": 4023.9425,
-            "1416445289801": 4006.9474999999998,
-            "1416447224801": 4040.59,
-            "1416446444801": 4028.0975,
-            "1416446984801": 4036.435,
-            "1416446609801": 4030.745,
-            "1416446729801": 4032.5525,
-            "1416446129801": 4022.7275,
-            "1416447644801": 4049.255,
-            "1416447164801": 4039.7375,
-            "1416446009801": 4020.825,
-            "1416448816363": 4106.9175,
-            "1416446219801": 4024.245,
-            "1416447539801": 4046.3975,
-            "1416445739801": 4015.8599999999997,
-            "1416446594801": 4030.365,
-            "1416445409801": 4008.9474999999998,
-            "1416447314801": 4042.6525,
-            "1416445679801": 4014.58,
-            "1416446924801": 4035.54,
-            "1416446624801": 4030.895,
-            "1416445994801": 4020.4624999999996,
-            "1416448846363": 4107.3525,
-            "1416445604801": 4012.57,
-            "1416446714801": 4032.2025,
-            "1416445514801": 4010.8725,
-            "1416445364801": 4007.8375,
-            "1416448681363": 4105.1125,
-            "1416447329801": 4043.1025,
-            "1416446234801": 4024.5275,
-            "1416447209801": 4040.42,
-            "1416448696363": 4105.3625,
-            "1416446954801": 4035.885,
-            "1416447404801": 4044.265,
-            "1416445559801": 4011.665,
-            "1416447044801": 4037.8475,
-            "1416447194801": 4040.08,
-            "1416445964801": 4020.1075,
-            "1416446324801": 4026.2075,
-            "1416446264801": 4025.03,
-            "1416448831363": 4107.2,
-            "1416446864801": 4034.635,
-            "1416448756363": 4106.07,
-            "1416446564801": 4030.005,
-            "1416445664801": 4014.1949999999997,
-            "1416447104801": 4038.855,
-            "1416448726363": 4105.842500000001,
-            "1416447344801": 4043.29,
-            "1416445274801": 4006.6475,
-            "1416448876363": 4107.65,
-            "1416445439801": 4009.185,
-            "1416446489801": 4028.8375,
-            "1416446369801": 4026.915,
-            "1416447524801": 4046.2525,
-            "1416447449801": 4045.09
+          "1416445244801": 4006.085,
+          "1416445259801": 4006.29,
+          "1416445274801": 4006.6475,
+          "1416445289801": 4006.9474999999998,
+          "1416445304801": 4007.1025,
+          "1416445319801": 4007.21,
+          "1416445364801": 4007.8375,
+          "1416445379801": 4008.0425000000005,
+          "1416445394801": 4008.37,
+          "1416445409801": 4008.9474999999998,
+          "1416445424801": 4009.08,
+          "1416445439801": 4009.185,
+          "1416445484801": 4009.9525,
+          "1416445499801": 4010.19,
+          "1416445514801": 4010.8725,
+          "1416445529801": 4011.3424999999997,
+          "1416445544801": 4011.4975000000004,
+          "1416445559801": 4011.665,
+          "1416445604801": 4012.57,
+          "1416445619801": 4012.9325,
+          "1416445634801": 4013.3424999999997,
+          "1416445649801": 4013.9225,
+          "1416445664801": 4014.1949999999997,
+          "1416445679801": 4014.58,
+          "1416445724801": 4015.73,
+          "1416445739801": 4015.8599999999997,
+          "1416445964801": 4020.1075,
+          "1416445979801": 4020.2975,
+          "1416445994801": 4020.4624999999996,
+          "1416446009801": 4020.825,
+          "1416446024801": 4020.96,
+          "1416446084801": 4021.9725,
+          "1416446099801": 4022.2,
+          "1416446114801": 4022.3775,
+          "1416446129801": 4022.7275,
+          "1416446144801": 4022.98,
+          "1416446204801": 4023.9425,
+          "1416446219801": 4024.245,
+          "1416446234801": 4024.5275,
+          "1416446249801": 4024.925,
+          "1416446264801": 4025.03,
+          "1416446324801": 4026.2075,
+          "1416446339801": 4026.4125,
+          "1416446354801": 4026.5275,
+          "1416446369801": 4026.915,
+          "1416446384801": 4027.0550000000003,
+          "1416446444801": 4028.0975,
+          "1416446459801": 4028.2799999999997,
+          "1416446474801": 4028.4275,
+          "1416446489801": 4028.8375,
+          "1416446504801": 4028.98,
+          "1416446564801": 4030.005,
+          "1416446579801": 4030.1800000000003,
+          "1416446594801": 4030.365,
+          "1416446609801": 4030.745,
+          "1416446624801": 4030.895,
+          "1416446684801": 4031.7825,
+          "1416446699801": 4032.0175,
+          "1416446714801": 4032.2025,
+          "1416446729801": 4032.5525,
+          "1416446744801": 4032.82,
+          "1416446804801": 4033.7475,
+          "1416446819801": 4033.9700000000003,
+          "1416446834801": 4034.1425,
+          "1416446849801": 4034.4725,
+          "1416446864801": 4034.635,
+          "1416446924801": 4035.54,
+          "1416446939801": 4035.7175,
+          "1416446954801": 4035.885,
+          "1416446969801": 4036.255,
+          "1416446984801": 4036.435,
+          "1416447044801": 4037.8475,
+          "1416447059801": 4038.045,
+          "1416447074801": 4038.2025,
+          "1416447089801": 4038.7,
+          "1416447104801": 4038.855,
+          "1416447164801": 4039.7375,
+          "1416447179801": 4039.9025,
+          "1416447194801": 4040.08,
+          "1416447209801": 4040.42,
+          "1416447224801": 4040.59,
+          "1416447284801": 4041.51,
+          "1416447299801": 4041.85,
+          "1416447314801": 4042.6525,
+          "1416447329801": 4043.1025,
+          "1416447344801": 4043.29,
+          "1416447404801": 4044.265,
+          "1416447419801": 4044.52,
+          "1416447434801": 4044.705,
+          "1416447449801": 4045.09,
+          "1416447464801": 4045.325,
+          "1416447524801": 4046.2525,
+          "1416447539801": 4046.3975,
+          "1416447554801": 4046.55,
+          "1416447569801": 4046.865,
+          "1416447584801": 4047.0550000000003,
+          "1416447644801": 4049.255,
+          "1416448681363": 4105.1125,
+          "1416448696363": 4105.3625,
+          "1416448711363": 4105.6875,
+          "1416448726363": 4105.842500000001,
+          "1416448741363": 4105.9574999999995,
+          "1416448756363": 4106.07,
+          "1416448801363": 4106.74,
+          "1416448816363": 4106.9175,
+          "1416448831363": 4107.2,
+          "1416448846363": 4107.3525,
+          "1416448861363": 4107.545,
+          "1416448876363": 4107.65,
+          "1416448921363": 4109.2625,
+          "1416448936363": 4109.4,
+          "1416448936464": 4108.2
         }
     },
     {
@@ -124,92 +125,92 @@
         "appid": "HOST",
         "starttime": 1416445244801,
         "metrics": {
-            "1416486255040": "2.46145024E8",
-            "1416486305088": "2.46898688E8",
-            "1416486270053": "2.44318208E8",
-            "1416486260042": "2.46280192E8",
-            "1416486285067": "2.464768E8",
-            "1416486295077": "2.46898688E8",
-            "1416486275058": "2.464768E8",
-            "1416486300083": "2.46898688E8",
-            "1416486250037": "2.46272E8",
-            "1416486265047": "2.4641536E8",
-            "1416486290072": "2.46898688E8",
-            "1416486280063": "2.464768E8",
-            "1416486345123": "2.46898688E8",
-            "1416486320102": "2.46898688E8",
-            "1416486360135": "2.464768E8",
-            "1416486335113": "2.47025664E8",
-            "1416486310093": "2.4676352E8",
-            "1416486350128": "2.46595584E8",
-            "1416486325105": "2.46898688E8",
-            "1416486365140": "2.46603776E8",
-            "1416486340118": "2.47025664E8",
-            "1416486315097": "2.4676352E8",
-            "1416486330107": "2.46898688E8",
-            "1416486355133": "2.46341632E8",
-            "1416486370145": "2.46468608E8",
-            "1416486410180": "2.46898688E8",
-            "1416486395169": "2.464768E8",
-            "1416486385161": "2.464768E8",
-            "1416486400172": "2.464768E8",
-            "1416486415182": "2.47025664E8",
-            "1416486375151": "2.46341632E8",
-            "1416486390166": "2.464768E8",
-            "1416486425193": "2.47025664E8",
-            "1416486405177": "2.46603776E8",
-            "1416486420187": "2.47025664E8",
-            "1416486380156": "2.464768E8",
-            "1416486460224": "2.46890496E8",
-            "1416486435203": "2.4676352E8",
-            "1416486430198": "2.46890496E8",
-            "1416486450218": "2.46890496E8",
-            "1416486465229": "2.46890496E8",
-            "1416486480237": "2.4619008E8",
-            "1416486440208": "2.46898688E8",
-            "1416486475235": "2.46181888E8",
-            "1416486470230": "2.4643584E8",
-            "1416486455223": "2.46890496E8",
-            "1416486485242": "2.46317056E8",
-            "1416486445213": "2.46890496E8",
-            "1416486515266": "2.4619008E8",
-            "1416486490244": "2.46181888E8",
-            "1416486530279": "2.46890496E8",
-            "1416486545291": "2.47017472E8",
-            "1416486505260": "2.46317056E8",
-            "1416486520270": "2.4619008E8",
-            "1416486495249": "2.46181888E8",
-            "1416486535282": "2.46890496E8",
-            "1416486510261": "2.46317056E8",
-            "1416486540287": "2.46890496E8",
-            "1416486525276": "2.46317056E8",
-            "1416486500255": "2.46317056E8",
-            "1416486555300": "2.46882304E8",
-            "1416486570309": "2.47025664E8",
-            "1416486585321": "2.47025664E8",
-            "1416486600331": "2.46603776E8",
-            "1416486560301": "2.46890496E8",
-            "1416486575314": "2.47025664E8",
-            "1416486590325": "2.4672256E8",
-            "1416486550295": "2.46882304E8",
-            "1416486605336": "2.46603776E8",
-            "1416486565306": "2.47025664E8",
-            "1416486580315": "2.47025664E8",
-            "1416486595327": "2.46468608E8",
-            "1416486610337": "2.46595584E8",
-            "1416486650370": "2.47025664E8",
-            "1416486635365": "2.46603776E8",
-            "1416486625350": "2.46730752E8",
-            "1416486640360": "2.46603776E8",
-            "1416486665385": "2.4715264E8",
-            "1416486615342": "2.46468608E8",
-            "1416486655375": "2.4715264E8",
-            "1416486630354": "2.46730752E8",
-            "1416486645368": "2.46730752E8",
-            "1416486620345": "2.46603776E8",
-            "1416486660380": "2.4715264E8",
-            "1416486675392": "2.46890496E8",
-            "1416486690404": "2.47025664E8"
+          "1416486250037": "2.46272E8",
+          "1416486255040": "2.46145024E8",
+          "1416486260042": "2.46280192E8",
+          "1416486265047": "2.4641536E8",
+          "1416486270053": "2.44318208E8",
+          "1416486275058": "2.464768E8",
+          "1416486280063": "2.464768E8",
+          "1416486285067": "2.464768E8",
+          "1416486290072": "2.46898688E8",
+          "1416486295077": "2.46898688E8",
+          "1416486300083": "2.46898688E8",
+          "1416486305088": "2.46898688E8",
+          "1416486310093": "2.4676352E8",
+          "1416486315097": "2.4676352E8",
+          "1416486320102": "2.46898688E8",
+          "1416486325105": "2.46898688E8",
+          "1416486330107": "2.46898688E8",
+          "1416486335113": "2.47025664E8",
+          "1416486340118": "2.47025664E8",
+          "1416486345123": "2.46898688E8",
+          "1416486350128": "2.46595584E8",
+          "1416486355133": "2.46341632E8",
+          "1416486360135": "2.464768E8",
+          "1416486365140": "2.46603776E8",
+          "1416486370145": "2.46468608E8",
+          "1416486375151": "2.46341632E8",
+          "1416486380156": "2.464768E8",
+          "1416486385161": "2.464768E8",
+          "1416486390166": "2.464768E8",
+          "1416486395169": "2.464768E8",
+          "1416486400172": "2.464768E8",
+          "1416486405177": "2.46603776E8",
+          "1416486410180": "2.46898688E8",
+          "1416486415182": "2.47025664E8",
+          "1416486420187": "2.47025664E8",
+          "1416486425193": "2.47025664E8",
+          "1416486430198": "2.46890496E8",
+          "1416486435203": "2.4676352E8",
+          "1416486440208": "2.46898688E8",
+          "1416486445213": "2.46890496E8",
+          "1416486450218": "2.46890496E8",
+          "1416486455223": "2.46890496E8",
+          "1416486460224": "2.46890496E8",
+          "1416486465229": "2.46890496E8",
+          "1416486470230": "2.4643584E8",
+          "1416486475235": "2.46181888E8",
+          "1416486480237": "2.4619008E8",
+          "1416486485242": "2.46317056E8",
+          "1416486490244": "2.46181888E8",
+          "1416486495249": "2.46181888E8",
+          "1416486500255": "2.46317056E8",
+          "1416486505260": "2.46317056E8",
+          "1416486510261": "2.46317056E8",
+          "1416486515266": "2.4619008E8",
+          "1416486520270": "2.4619008E8",
+          "1416486525276": "2.46317056E8",
+          "1416486530279": "2.46890496E8",
+          "1416486535282": "2.46890496E8",
+          "1416486540287": "2.46890496E8",
+          "1416486545291": "2.47017472E8",
+          "1416486550295": "2.46882304E8",
+          "1416486555300": "2.46882304E8",
+          "1416486560301": "2.46890496E8",
+          "1416486565306": "2.47025664E8",
+          "1416486570309": "2.47025664E8",
+          "1416486575314": "2.47025664E8",
+          "1416486580315": "2.47025664E8",
+          "1416486585321": "2.47025664E8",
+          "1416486590325": "2.4672256E8",
+          "1416486595327": "2.46468608E8",
+          "1416486600331": "2.46603776E8",
+          "1416486605336": "2.46603776E8",
+          "1416486610337": "2.46595584E8",
+          "1416486615342": "2.46468608E8",
+          "1416486620345": "2.46603776E8",
+          "1416486625350": "2.46730752E8",
+          "1416486630354": "2.46730752E8",
+          "1416486635365": "2.46603776E8",
+          "1416486640360": "2.46603776E8",
+          "1416486645368": "2.46730752E8",
+          "1416486650370": "2.47025664E8",
+          "1416486655375": "2.4715264E8",
+          "1416486660380": "2.4715264E8",
+          "1416486665385": "2.4715264E8",
+          "1416486675392": "2.46890496E8",
+          "1416486690404": "2.47025664E8"
         }
     }
 ]}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1dccde1/ambari-server/src/test/resources/ams/single_host_metric.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/ams/single_host_metric.json b/ambari-server/src/test/resources/ams/single_host_metric.json
index 8e6c1e1..e8b7c14 100644
--- a/ambari-server/src/test/resources/ams/single_host_metric.json
+++ b/ambari-server/src/test/resources/ams/single_host_metric.json
@@ -5,117 +5,118 @@
         "appid": "HOST",
         "starttime": 1416445244801,
         "metrics": {
-            "1416446384801": 4027.0550000000003,
-            "1416445244801": 4006.085,
-            "1416448711363": 4105.6875,
-            "1416446744801": 4032.82,
-            "1416446969801": 4036.255,
-            "1416445544801": 4011.4975000000004,
-            "1416446849801": 4034.4725,
-            "1416446024801": 4020.96,
-            "1416445979801": 4020.2975,
-            "1416448921363": 4109.2625,
-            "1416446144801": 4022.98,
-            "1416447569801": 4046.865,
-            "1416445394801": 4008.37,
-            "1416445319801": 4007.21,
-            "1416445484801": 4009.9525,
-            "1416446939801": 4035.7175,
-            "1416447419801": 4044.52,
-            "1416447464801": 4045.325,
-            "1416445634801": 4013.3424999999997,
-            "1416447299801": 4041.85,
-            "1416446459801": 4028.2799999999997,
-            "1416446804801": 4033.7475,
-            "1416446099801": 4022.2,
-            "1416447074801": 4038.2025,
-            "1416446699801": 4032.0175,
-            "1416446819801": 4033.9700000000003,
-            "1416446249801": 4024.925,
-            "1416445724801": 4015.73,
-            "1416446579801": 4030.1800000000003,
-            "1416445379801": 4008.0425000000005,
-            "1416447284801": 4041.51,
-            "1416446114801": 4022.3775,
-            "1416447179801": 4039.9025,
-            "1416448861363": 4107.545,
-            "1416448801363": 4106.74,
-            "1416446834801": 4034.1425,
-            "1416448741363": 4105.9574999999995,
-            "1416445259801": 4006.29,
-            "1416445499801": 4010.19,
-            "1416446474801": 4028.4275,
-            "1416448936363": 4109.4,
-            "1416445529801": 4011.3424999999997,
-            "1416447554801": 4046.55,
-            "1416446684801": 4031.7825,
-            "1416445424801": 4009.08,
-            "1416447584801": 4047.0550000000003,
-            "1416447434801": 4044.705,
-            "1416446084801": 4021.9725,
-            "1416446504801": 4028.98,
-            "1416446354801": 4026.5275,
-            "1416446339801": 4026.4125,
-            "1416445619801": 4012.9325,
-            "1416447059801": 4038.045,
-            "1416447089801": 4038.7,
-            "1416445304801": 4007.1025,
-            "1416445649801": 4013.9225,
-            "1416446204801": 4023.9425,
-            "1416445289801": 4006.9474999999998,
-            "1416447224801": 4040.59,
-            "1416446444801": 4028.0975,
-            "1416446984801": 4036.435,
-            "1416446609801": 4030.745,
-            "1416446729801": 4032.5525,
-            "1416446129801": 4022.7275,
-            "1416447644801": 4049.255,
-            "1416447164801": 4039.7375,
-            "1416446009801": 4020.825,
-            "1416448816363": 4106.9175,
-            "1416446219801": 4024.245,
-            "1416447539801": 4046.3975,
-            "1416445739801": 4015.8599999999997,
-            "1416446594801": 4030.365,
-            "1416445409801": 4008.9474999999998,
-            "1416447314801": 4042.6525,
-            "1416445679801": 4014.58,
-            "1416446924801": 4035.54,
-            "1416446624801": 4030.895,
-            "1416445994801": 4020.4624999999996,
-            "1416448846363": 4107.3525,
-            "1416445604801": 4012.57,
-            "1416446714801": 4032.2025,
-            "1416445514801": 4010.8725,
-            "1416445364801": 4007.8375,
-            "1416448681363": 4105.1125,
-            "1416447329801": 4043.1025,
-            "1416446234801": 4024.5275,
-            "1416447209801": 4040.42,
-            "1416448696363": 4105.3625,
-            "1416446954801": 4035.885,
-            "1416447404801": 4044.265,
-            "1416445559801": 4011.665,
-            "1416447044801": 4037.8475,
-            "1416447194801": 4040.08,
-            "1416445964801": 4020.1075,
-            "1416446324801": 4026.2075,
-            "1416446264801": 4025.03,
-            "1416448831363": 4107.2,
-            "1416446864801": 4034.635,
-            "1416448756363": 4106.07,
-            "1416446564801": 4030.005,
-            "1416445664801": 4014.1949999999997,
-            "1416447104801": 4038.855,
-            "1416448726363": 4105.842500000001,
-            "1416447344801": 4043.29,
-            "1416445274801": 4006.6475,
-            "1416448876363": 4107.65,
-            "1416445439801": 4009.185,
-            "1416446489801": 4028.8375,
-            "1416446369801": 4026.915,
-            "1416447524801": 4046.2525,
-            "1416447449801": 4045.09
+          "1416445244801": 4006.085,
+          "1416445259801": 4006.29,
+          "1416445274801": 4006.6475,
+          "1416445289801": 4006.9474999999998,
+          "1416445304801": 4007.1025,
+          "1416445319801": 4007.21,
+          "1416445364801": 4007.8375,
+          "1416445379801": 4008.0425000000005,
+          "1416445394801": 4008.37,
+          "1416445409801": 4008.9474999999998,
+          "1416445424801": 4009.08,
+          "1416445439801": 4009.185,
+          "1416445484801": 4009.9525,
+          "1416445499801": 4010.19,
+          "1416445514801": 4010.8725,
+          "1416445529801": 4011.3424999999997,
+          "1416445544801": 4011.4975000000004,
+          "1416445559801": 4011.665,
+          "1416445604801": 4012.57,
+          "1416445619801": 4012.9325,
+          "1416445634801": 4013.3424999999997,
+          "1416445649801": 4013.9225,
+          "1416445664801": 4014.1949999999997,
+          "1416445679801": 4014.58,
+          "1416445724801": 4015.73,
+          "1416445739801": 4015.8599999999997,
+          "1416445964801": 4020.1075,
+          "1416445979801": 4020.2975,
+          "1416445994801": 4020.4624999999996,
+          "1416446009801": 4020.825,
+          "1416446024801": 4020.96,
+          "1416446084801": 4021.9725,
+          "1416446099801": 4022.2,
+          "1416446114801": 4022.3775,
+          "1416446129801": 4022.7275,
+          "1416446144801": 4022.98,
+          "1416446204801": 4023.9425,
+          "1416446219801": 4024.245,
+          "1416446234801": 4024.5275,
+          "1416446249801": 4024.925,
+          "1416446264801": 4025.03,
+          "1416446324801": 4026.2075,
+          "1416446339801": 4026.4125,
+          "1416446354801": 4026.5275,
+          "1416446369801": 4026.915,
+          "1416446384801": 4027.0550000000003,
+          "1416446444801": 4028.0975,
+          "1416446459801": 4028.2799999999997,
+          "1416446474801": 4028.4275,
+          "1416446489801": 4028.8375,
+          "1416446504801": 4028.98,
+          "1416446564801": 4030.005,
+          "1416446579801": 4030.1800000000003,
+          "1416446594801": 4030.365,
+          "1416446609801": 4030.745,
+          "1416446624801": 4030.895,
+          "1416446684801": 4031.7825,
+          "1416446699801": 4032.0175,
+          "1416446714801": 4032.2025,
+          "1416446729801": 4032.5525,
+          "1416446744801": 4032.82,
+          "1416446804801": 4033.7475,
+          "1416446819801": 4033.9700000000003,
+          "1416446834801": 4034.1425,
+          "1416446849801": 4034.4725,
+          "1416446864801": 4034.635,
+          "1416446924801": 4035.54,
+          "1416446939801": 4035.7175,
+          "1416446954801": 4035.885,
+          "1416446969801": 4036.255,
+          "1416446984801": 4036.435,
+          "1416447044801": 4037.8475,
+          "1416447059801": 4038.045,
+          "1416447074801": 4038.2025,
+          "1416447089801": 4038.7,
+          "1416447104801": 4038.855,
+          "1416447164801": 4039.7375,
+          "1416447179801": 4039.9025,
+          "1416447194801": 4040.08,
+          "1416447209801": 4040.42,
+          "1416447224801": 4040.59,
+          "1416447284801": 4041.51,
+          "1416447299801": 4041.85,
+          "1416447314801": 4042.6525,
+          "1416447329801": 4043.1025,
+          "1416447344801": 4043.29,
+          "1416447404801": 4044.265,
+          "1416447419801": 4044.52,
+          "1416447434801": 4044.705,
+          "1416447449801": 4045.09,
+          "1416447464801": 4045.325,
+          "1416447524801": 4046.2525,
+          "1416447539801": 4046.3975,
+          "1416447554801": 4046.55,
+          "1416447569801": 4046.865,
+          "1416447584801": 4047.0550000000003,
+          "1416447644801": 4049.255,
+          "1416448681363": 4105.1125,
+          "1416448696363": 4105.3625,
+          "1416448711363": 4105.6875,
+          "1416448726363": 4105.842500000001,
+          "1416448741363": 4105.9574999999995,
+          "1416448756363": 4106.07,
+          "1416448801363": 4106.74,
+          "1416448816363": 4106.9175,
+          "1416448831363": 4107.2,
+          "1416448846363": 4107.3525,
+          "1416448861363": 4107.545,
+          "1416448876363": 4107.65,
+          "1416448921363": 4109.2625,
+          "1416448936363": 4109.4,
+          "1416448936464": 4108.2
         }
     }
 ]}
\ No newline at end of file


Mime
View raw message