ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject [1/2] ambari git commit: AMBARI-13543. Redundant metrics in exported CSV and JSON files for Flume graphs
Date Fri, 23 Oct 2015 13:13:59 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 502dc1862 -> 6a10db2b6


AMBARI-13543. Redundant metrics in exported CSV and JSON files for Flume graphs


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

Branch: refs/heads/trunk
Commit: 6a10db2b6c81e7baf4b0cfc0acd6f69a5ef94dc2
Parents: b27212d
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Fri Oct 23 16:13:42 2015 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Fri Oct 23 16:13:51 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |   6 +
 ambari-web/app/utils/ajax/ajax.js               |  16 +++
 .../info/metrics/flume/channel_size_mma.js      |  17 ++-
 .../service/info/metrics/flume/channel_sum.js   |  10 +-
 .../info/metrics/flume/flume_incoming_mma.js    |  17 ++-
 .../info/metrics/flume/flume_incoming_sum.js    |  10 +-
 .../info/metrics/flume/flume_outgoing_mma.js    |  17 ++-
 .../info/metrics/flume/flume_outgoing_sum.js    |  10 +-
 .../info/metrics/flume/channel_size_mma_test.js | 142 +++++++++++++++++++
 .../info/metrics/flume/channel_sum_test.js      | 108 ++++++++++++++
 .../metrics/flume/flume_incoming_mma_test.js    | 142 +++++++++++++++++++
 .../metrics/flume/flume_incoming_sum_test.js    | 108 ++++++++++++++
 .../metrics/flume/flume_outgoing_mma_test.js    | 142 +++++++++++++++++++
 .../metrics/flume/flume_outgoing_sum_test.js    | 108 ++++++++++++++
 14 files changed, 808 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6a10db2b/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index f79658c..f0b5dde 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -257,6 +257,12 @@ var files = [
   'test/views/main/service/info/config_test',
   'test/views/main/service/info/summary_test',
   'test/views/main/service/info/metrics/ambari_metrics/regionserver_base_test',
+  'test/views/main/service/info/metrics/flume/channel_size_mma_test',
+  'test/views/main/service/info/metrics/flume/channel_sum_test',
+  'test/views/main/service/info/metrics/flume/flume_incoming_mma_test',
+  'test/views/main/service/info/metrics/flume/flume_incoming_sum_test',
+  'test/views/main/service/info/metrics/flume/flume_outgoing_mma_test',
+  'test/views/main/service/info/metrics/flume/flume_outgoing_sum_test',
   'test/views/main/service/services/ranger_test',
   'test/views/main/service/widgets/create/expression_view_test',
   'test/views/main/admin/highAvailability/nameNode/step1_view_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a10db2b/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 7fc1a23..3023cfc 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -970,6 +970,12 @@ var urls = {
   'service.metrics.flume.channel_size_for_all': {
     'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=metrics/flume/flume/CHANNEL/ChannelSize/rate[{fromSeconds},{toSeconds},{stepSeconds}]'
   },
+  'service.metrics.flume.channel_size_for_all.mma': {
+    'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=metrics/flume/flume/CHANNEL/ChannelSize/rate/avg[{fromSeconds},{toSeconds},{stepSeconds}],metrics/flume/flume/CHANNEL/ChannelSize/rate/max[{fromSeconds},{toSeconds},{stepSeconds}],metrics/flume/flume/CHANNEL/ChannelSize/rate/min[{fromSeconds},{toSeconds},{stepSeconds}]'
+  },
+  'service.metrics.flume.channel_size_for_all.sum': {
+    'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=metrics/flume/flume/CHANNEL/ChannelSize/rate/sum[{fromSeconds},{toSeconds},{stepSeconds}]'
+  },
   'service.metrics.flume.gc': {
     'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/jvm/gcTimeMillis[{fromSeconds},{toSeconds},{stepSeconds}]',
     'mock': '/data/services/metrics/flume/jvmGcTime.json',
@@ -992,10 +998,20 @@ var urls = {
   },
   'service.metrics.flume.incoming_event_put_successCount': {
     'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=metrics/flume/flume/CHANNEL/EventPutSuccessCount/rate[{fromSeconds},{toSeconds},{stepSeconds}]'
+  },'service.metrics.flume.incoming_event_put_successCount.mma': {
+    'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=metrics/flume/flume/CHANNEL/EventPutSuccessCount/rate/avg[{fromSeconds},{toSeconds},{stepSeconds}],metrics/flume/flume/CHANNEL/EventPutSuccessCount/rate/max[{fromSeconds},{toSeconds},{stepSeconds}],metrics/flume/flume/CHANNEL/EventPutSuccessCount/rate/min[{fromSeconds},{toSeconds},{stepSeconds}]'
+  },'service.metrics.flume.incoming_event_put_successCount.sum': {
+    'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=metrics/flume/flume/CHANNEL/EventPutSuccessCount/rate/sum[{fromSeconds},{toSeconds},{stepSeconds}]'
   },
   'service.metrics.flume.outgoing_event_take_success_count': {
     'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=metrics/flume/flume/CHANNEL/EventTakeSuccessCount/rate[{fromSeconds},{toSeconds},{stepSeconds}]'
   },
+  'service.metrics.flume.outgoing_event_take_success_count.mma': {
+    'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=metrics/flume/flume/CHANNEL/EventTakeSuccessCount/rate/avg[{fromSeconds},{toSeconds},{stepSeconds}],metrics/flume/flume/CHANNEL/EventTakeSuccessCount/rate/max[{fromSeconds},{toSeconds},{stepSeconds}],metrics/flume/flume/CHANNEL/EventTakeSuccessCount/rate/min[{fromSeconds},{toSeconds},{stepSeconds}]'
+  },
+  'service.metrics.flume.outgoing_event_take_success_count.sum': {
+    'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=metrics/flume/flume/CHANNEL/EventTakeSuccessCount/rate/sum[{fromSeconds},{toSeconds},{stepSeconds}]'
+  },
   'service.metrics.hbase.cluster_requests': {
     'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_MASTER?fields=metrics/hbase/master/cluster_requests[{fromSeconds},{toSeconds},{stepSeconds}]',
     'mock': '/data/services/metrics/hbase/cluster_requests.json',

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a10db2b/ambari-web/app/views/main/service/info/metrics/flume/channel_size_mma.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/metrics/flume/channel_size_mma.js b/ambari-web/app/views/main/service/info/metrics/flume/channel_size_mma.js
index ba0fd0f..d4c1fe0 100644
--- a/ambari-web/app/views/main/service/info/metrics/flume/channel_size_mma.js
+++ b/ambari-web/app/views/main/service/info/metrics/flume/channel_size_mma.js
@@ -30,22 +30,21 @@ App.ChartServiceMetricsFlume_ChannelSizeMMA = App.ChartLinearTimeView.extend({
   id: "service-metrics-flume-channel-size-mma",
   title: Em.I18n.t('services.service.info.metrics.flume.channelSizeMMA'),
   renderer: 'line',
-  ajaxIndex: 'service.metrics.flume.channel_size_for_all',
+  ajaxIndex: 'service.metrics.flume.channel_size_for_all.mma',
   yAxisFormatter: App.ChartLinearTimeView.CreateRateFormatter('',
     App.ChartLinearTimeView.DefaultFormatter),
 
   transformToSeries: function (jsonData) {
     var seriesArray = [];
     var self = this;
+    var data = Em.get(jsonData, 'metrics.flume.flume.CHANNEL.ChannelSize.rate');
 
-    if (Em.get(jsonData, "metrics.flume.flume.CHANNEL.ChannelSize.rate")) {
-      for ( var cname in jsonData.metrics.flume.flume.CHANNEL.ChannelSize.rate) {
-        if(cname != "sum"){
-          var seriesName = Em.I18n.t('services.service.info.metrics.flume.channelType').format(cname);
-          var seriesData = jsonData.metrics.flume.flume.CHANNEL.ChannelSize.rate[cname];
-          if (seriesData) {
-            seriesArray.push(self.transformData(seriesData, seriesName));
-          }
+    if (data) {
+      for (var cname in data) {
+        var seriesName = Em.I18n.t('services.service.info.metrics.flume.channelType').format(cname);
+        var seriesData = data[cname];
+        if (seriesData) {
+          seriesArray.push(self.transformData(seriesData, seriesName));
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a10db2b/ambari-web/app/views/main/service/info/metrics/flume/channel_sum.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/metrics/flume/channel_sum.js b/ambari-web/app/views/main/service/info/metrics/flume/channel_sum.js
index 6056fe3..b102575 100644
--- a/ambari-web/app/views/main/service/info/metrics/flume/channel_sum.js
+++ b/ambari-web/app/views/main/service/info/metrics/flume/channel_sum.js
@@ -31,17 +31,15 @@ App.ChartServiceMetricsFlume_ChannelSizeSum = App.ChartLinearTimeView.extend({
   title: Em.I18n.t('services.service.info.metrics.flume.channelSizeSum'),
   yAxisFormatter: App.ChartLinearTimeView.BytesFormatter,
 
-  ajaxIndex: 'service.metrics.flume.channel_size_for_all',
+  ajaxIndex: 'service.metrics.flume.channel_size_for_all.sum',
 
   transformToSeries: function (jsonData) {
     var seriesArray = [];
     var self = this;
-    if(Em.get(jsonData, "metrics.flume.flume.CHANNEL.ChannelSize.rate.sum")){
+    var seriesData = Em.get(jsonData, 'metrics.flume.flume.CHANNEL.ChannelSize.rate.sum');
+    if (seriesData) {
       var seriesName = Em.I18n.t('services.service.info.metrics.flume.channelSizeSum');
-      var seriesData = jsonData.metrics.flume.flume.CHANNEL.ChannelSize.rate.sum;
-      if (seriesData) {
-        seriesArray.push(self.transformData(seriesData, seriesName));
-      }
+      seriesArray.push(self.transformData(seriesData, seriesName));
     }
     return seriesArray;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a10db2b/ambari-web/app/views/main/service/info/metrics/flume/flume_incoming_mma.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/metrics/flume/flume_incoming_mma.js b/ambari-web/app/views/main/service/info/metrics/flume/flume_incoming_mma.js
index 77fce83..48ee7f6 100644
--- a/ambari-web/app/views/main/service/info/metrics/flume/flume_incoming_mma.js
+++ b/ambari-web/app/views/main/service/info/metrics/flume/flume_incoming_mma.js
@@ -30,22 +30,21 @@ App.ChartServiceMetricsFlume_IncommingMMA = App.ChartLinearTimeView.extend({
   renderer: 'line',
   title: Em.I18n.t('services.service.info.metrics.flume.incoming.mma'),
 
-  ajaxIndex: 'service.metrics.flume.incoming_event_put_successCount',
+  ajaxIndex: 'service.metrics.flume.incoming_event_put_successCount.mma',
   yAxisFormatter: App.ChartLinearTimeView.CreateRateFormatter('',
       App.ChartLinearTimeView.DefaultFormatter),
 
   transformToSeries: function (jsonData) {
     var seriesArray = [];
     var self = this;
+    var data = Em.get(jsonData, 'metrics.flume.flume.CHANNEL.EventPutSuccessCount.rate');
 
-    if (Em.get(jsonData, "metrics.flume.flume.CHANNEL.EventPutSuccessCount.rate")) {
-      for ( var cname in jsonData.metrics.flume.flume.CHANNEL.EventPutSuccessCount.rate)
{
-        if(cname != "sum"){
-          var seriesName = Em.I18n.t('services.service.info.metrics.flume.incoming_mma').format(cname);
-          var seriesData = jsonData.metrics.flume.flume.CHANNEL.EventPutSuccessCount.rate[cname];
-          if (seriesData) {
-            seriesArray.push(self.transformData(seriesData, seriesName));
-          }
+    if (data) {
+      for (var cname in data) {
+        var seriesName = Em.I18n.t('services.service.info.metrics.flume.incoming_mma').format(cname);
+        var seriesData = data[cname];
+        if (seriesData) {
+          seriesArray.push(self.transformData(seriesData, seriesName));
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a10db2b/ambari-web/app/views/main/service/info/metrics/flume/flume_incoming_sum.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/metrics/flume/flume_incoming_sum.js b/ambari-web/app/views/main/service/info/metrics/flume/flume_incoming_sum.js
index 973719b..51a1287 100644
--- a/ambari-web/app/views/main/service/info/metrics/flume/flume_incoming_sum.js
+++ b/ambari-web/app/views/main/service/info/metrics/flume/flume_incoming_sum.js
@@ -29,17 +29,15 @@ App.ChartServiceMetricsFlume_IncommingSum = App.ChartLinearTimeView.extend({
   id: "service-metrics-flume-incoming_sum",
   title: Em.I18n.t('services.service.info.metrics.flume.incoming.sum'),
 
-  ajaxIndex: 'service.metrics.flume.incoming_event_put_successCount',
+  ajaxIndex: 'service.metrics.flume.incoming_event_put_successCount.sum',
 
   transformToSeries: function (jsonData) {
     var seriesArray = [];
     var self = this;
-    if(Em.get(jsonData, "metrics.flume.flume.CHANNEL.EventPutSuccessCount.rate.sum")){
+    var seriesData = Em.get(jsonData, 'metrics.flume.flume.CHANNEL.EventPutSuccessCount.rate.sum');
+    if (seriesData) {
       var seriesName = Em.I18n.t('services.service.info.metrics.flume.incoming.sum');
-      var seriesData = jsonData.metrics.flume.flume.CHANNEL.EventPutSuccessCount.rate.sum;
-      if (seriesData) {
-        seriesArray.push(self.transformData(seriesData, seriesName));
-      }
+      seriesArray.push(self.transformData(seriesData, seriesName));
     }
     return seriesArray;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a10db2b/ambari-web/app/views/main/service/info/metrics/flume/flume_outgoing_mma.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/metrics/flume/flume_outgoing_mma.js b/ambari-web/app/views/main/service/info/metrics/flume/flume_outgoing_mma.js
index 311a472..ea1b947 100644
--- a/ambari-web/app/views/main/service/info/metrics/flume/flume_outgoing_mma.js
+++ b/ambari-web/app/views/main/service/info/metrics/flume/flume_outgoing_mma.js
@@ -30,22 +30,21 @@ App.ChartServiceMetricsFlume_OutgoingMMA = App.ChartLinearTimeView.extend({
   renderer: 'line',
   title: Em.I18n.t('services.service.info.metrics.flume.outgoing.mma'),
 
-  ajaxIndex: 'service.metrics.flume.outgoing_event_take_success_count',
+  ajaxIndex: 'service.metrics.flume.outgoing_event_take_success_count.mma',
   yAxisFormatter: App.ChartLinearTimeView.CreateRateFormatter('',
       App.ChartLinearTimeView.DefaultFormatter),
 
   transformToSeries: function (jsonData) {
     var seriesArray = [];
     var self = this;
+    var data = Em.get(jsonData, 'metrics.flume.flume.CHANNEL.EventTakeSuccessCount.rate');
 
-    if (Em.get(jsonData, "metrics.flume.flume.CHANNEL.EventTakeSuccessCount.rate")) {
-      for ( var cname in jsonData.metrics.flume.flume.CHANNEL.EventTakeSuccessCount.rate)
{
-        if(cname != "sum"){
-          var seriesName = Em.I18n.t('services.service.info.metrics.flume.outgoing_mma').format(cname);
-          var seriesData = jsonData.metrics.flume.flume.CHANNEL.EventTakeSuccessCount.rate[cname];
-          if (seriesData) {
-            seriesArray.push(self.transformData(seriesData, seriesName));
-          }
+    if (data) {
+      for (var cname in data) {
+        var seriesName = Em.I18n.t('services.service.info.metrics.flume.outgoing_mma').format(cname);
+        var seriesData = data[cname];
+        if (seriesData) {
+          seriesArray.push(self.transformData(seriesData, seriesName));
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a10db2b/ambari-web/app/views/main/service/info/metrics/flume/flume_outgoing_sum.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/metrics/flume/flume_outgoing_sum.js b/ambari-web/app/views/main/service/info/metrics/flume/flume_outgoing_sum.js
index 50f8be0..8862f8c 100644
--- a/ambari-web/app/views/main/service/info/metrics/flume/flume_outgoing_sum.js
+++ b/ambari-web/app/views/main/service/info/metrics/flume/flume_outgoing_sum.js
@@ -29,17 +29,15 @@ App.ChartServiceMetricsFlume_OutgoingSum = App.ChartLinearTimeView.extend({
   id: "service-metrics-flume-outgoing_sum",
   title: Em.I18n.t('services.service.info.metrics.flume.outgoing.sum'),
 
-  ajaxIndex: 'service.metrics.flume.outgoing_event_take_success_count',
+  ajaxIndex: 'service.metrics.flume.outgoing_event_take_success_count.sum',
 
   transformToSeries: function (jsonData) {
     var seriesArray = [];
     var self = this;
-    if(Em.get(jsonData, "metrics.flume.flume.CHANNEL.EventTakeSuccessCount.rate.sum")){
+    var seriesData = Em.get(jsonData, 'metrics.flume.flume.CHANNEL.EventTakeSuccessCount.rate.sum');
+    if (seriesData) {
       var seriesName = Em.I18n.t('services.service.info.metrics.flume.outgoing.sum');
-      var seriesData = jsonData.metrics.flume.flume.CHANNEL.EventTakeSuccessCount.rate.sum;
-      if (seriesData) {
-        seriesArray.push(self.transformData(seriesData, seriesName));
-      }
+      seriesArray.push(self.transformData(seriesData, seriesName));
     }
     return seriesArray;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a10db2b/ambari-web/test/views/main/service/info/metrics/flume/channel_size_mma_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/metrics/flume/channel_size_mma_test.js
b/ambari-web/test/views/main/service/info/metrics/flume/channel_size_mma_test.js
new file mode 100644
index 0000000..16068cd
--- /dev/null
+++ b/ambari-web/test/views/main/service/info/metrics/flume/channel_size_mma_test.js
@@ -0,0 +1,142 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+require('views/main/service/info/metrics/flume/channel_size_mma');
+
+describe('App.ChartServiceMetricsFlume_ChannelSizeMMA', function () {
+
+  var view;
+
+  beforeEach(function () {
+    view = App.ChartServiceMetricsFlume_ChannelSizeMMA.create();
+  });
+
+  describe('#transformToSeries', function () {
+
+    var cases = [
+      {
+        data: {},
+        seriesArray: [],
+        title: 'empty response'
+      },
+      {
+        data: {
+          metrics: {}
+        },
+        seriesArray: [],
+        title: 'invalid response'
+      },
+      {
+        data: {
+          metrics: {
+            flume: {
+              flume: {
+                CHANNEL: {
+                  ChannelSize: {
+                    rate: null
+                  }
+                }
+              }
+            }
+          }
+        },
+        seriesArray: [],
+        title: 'empty data'
+      },
+      {
+        data: {
+          metrics: {
+            flume: {
+              flume: {
+                CHANNEL: {
+                  ChannelSize: {
+                    rate: {
+                      avg: [
+                        [0, 1445472000],
+                        [1, 1445472015]
+                      ],
+                      max: [
+                        [2, 1445472000],
+                        [3, 1445472015]
+                      ],
+                      min: [
+                        [4, 1445472000],
+                        [5, 1445472015]
+                      ]
+                    }
+                  }
+                }
+              }
+            }
+          }
+        },
+        seriesArray: [
+          {
+            name: Em.I18n.t('services.service.info.metrics.flume.channelType').format('avg'),
+            data: [
+              {
+                x: 1445472000,
+                y: 0
+              },
+              {
+                x: 1445472015,
+                y: 1
+              }
+            ]
+          },
+          {
+            name: Em.I18n.t('services.service.info.metrics.flume.channelType').format('max'),
+            data: [
+              {
+                x: 1445472000,
+                y: 2
+              },
+              {
+                x: 1445472015,
+                y: 3
+              }
+            ]
+          },
+          {
+            name: Em.I18n.t('services.service.info.metrics.flume.channelType').format('min'),
+            data: [
+              {
+                x: 1445472000,
+                y: 4
+              },
+              {
+                x: 1445472015,
+                y: 5
+              }
+            ]
+          }
+        ],
+        title: 'valid data'
+      }
+    ];
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        expect(view.transformToSeries(item.data)).to.eql(item.seriesArray);
+      });
+    });
+
+  });
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a10db2b/ambari-web/test/views/main/service/info/metrics/flume/channel_sum_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/metrics/flume/channel_sum_test.js b/ambari-web/test/views/main/service/info/metrics/flume/channel_sum_test.js
new file mode 100644
index 0000000..03ad3f7
--- /dev/null
+++ b/ambari-web/test/views/main/service/info/metrics/flume/channel_sum_test.js
@@ -0,0 +1,108 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+require('views/main/service/info/metrics/flume/channel_sum');
+
+describe('App.ChartServiceMetricsFlume_ChannelSizeSum', function () {
+
+  var view;
+
+  beforeEach(function () {
+    view = App.ChartServiceMetricsFlume_ChannelSizeSum.create();
+  });
+
+  describe('#transformToSeries', function () {
+
+    var cases = [
+      {
+        data: {},
+        seriesArray: [],
+        title: 'empty response'
+      },
+      {
+        data: {
+          metrics: {}
+        },
+        seriesArray: [],
+        title: 'invalid response'
+      },
+      {
+        data: {
+          metrics: {
+            flume: {
+              flume: {
+                CHANNEL: {
+                  ChannelSize: {
+                    rate: null
+                  }
+                }
+              }
+            }
+          }
+        },
+        seriesArray: [],
+        title: 'empty data'
+      },
+      {
+        data: {
+          metrics: {
+            flume: {
+              flume: {
+                CHANNEL: {
+                  ChannelSize: {
+                    rate: {
+                      sum: [
+                        [0, 1445472000],
+                        [1, 1445472015]
+                      ]
+                    }
+                  }
+                }
+              }
+            }
+          }
+        },
+        seriesArray: [
+          {
+            name: Em.I18n.t('services.service.info.metrics.flume.channelSizeSum'),
+            data: [
+              {
+                x: 1445472000,
+                y: 0
+              },
+              {
+                x: 1445472015,
+                y: 1
+              }
+            ]
+          }
+        ],
+        title: 'valid data'
+      }
+    ];
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        expect(view.transformToSeries(item.data)).to.eql(item.seriesArray);
+      });
+    });
+
+  });
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a10db2b/ambari-web/test/views/main/service/info/metrics/flume/flume_incoming_mma_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/metrics/flume/flume_incoming_mma_test.js
b/ambari-web/test/views/main/service/info/metrics/flume/flume_incoming_mma_test.js
new file mode 100644
index 0000000..50748c5
--- /dev/null
+++ b/ambari-web/test/views/main/service/info/metrics/flume/flume_incoming_mma_test.js
@@ -0,0 +1,142 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+require('views/main/service/info/metrics/flume/flume_incoming_mma');
+
+describe('App.ChartServiceMetricsFlume_IncommingMMA', function () {
+
+  var view;
+
+  beforeEach(function () {
+    view = App.ChartServiceMetricsFlume_IncommingMMA.create();
+  });
+
+  describe('#transformToSeries', function () {
+
+    var cases = [
+      {
+        data: {},
+        seriesArray: [],
+        title: 'empty response'
+      },
+      {
+        data: {
+          metrics: {}
+        },
+        seriesArray: [],
+        title: 'invalid response'
+      },
+      {
+        data: {
+          metrics: {
+            flume: {
+              flume: {
+                CHANNEL: {
+                  EventPutSuccessCount: {
+                    rate: null
+                  }
+                }
+              }
+            }
+          }
+        },
+        seriesArray: [],
+        title: 'empty data'
+      },
+      {
+        data: {
+          metrics: {
+            flume: {
+              flume: {
+                CHANNEL: {
+                  EventPutSuccessCount: {
+                    rate: {
+                      avg: [
+                        [0, 1445472000],
+                        [1, 1445472015]
+                      ],
+                      max: [
+                        [2, 1445472000],
+                        [3, 1445472015]
+                      ],
+                      min: [
+                        [4, 1445472000],
+                        [5, 1445472015]
+                      ]
+                    }
+                  }
+                }
+              }
+            }
+          }
+        },
+        seriesArray: [
+          {
+            name: Em.I18n.t('services.service.info.metrics.flume.incoming_mma').format('avg'),
+            data: [
+              {
+                x: 1445472000,
+                y: 0
+              },
+              {
+                x: 1445472015,
+                y: 1
+              }
+            ]
+          },
+          {
+            name: Em.I18n.t('services.service.info.metrics.flume.incoming_mma').format('max'),
+            data: [
+              {
+                x: 1445472000,
+                y: 2
+              },
+              {
+                x: 1445472015,
+                y: 3
+              }
+            ]
+          },
+          {
+            name: Em.I18n.t('services.service.info.metrics.flume.incoming_mma').format('min'),
+            data: [
+              {
+                x: 1445472000,
+                y: 4
+              },
+              {
+                x: 1445472015,
+                y: 5
+              }
+            ]
+          }
+        ],
+        title: 'valid data'
+      }
+    ];
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        expect(view.transformToSeries(item.data)).to.eql(item.seriesArray);
+      });
+    });
+
+  });
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a10db2b/ambari-web/test/views/main/service/info/metrics/flume/flume_incoming_sum_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/metrics/flume/flume_incoming_sum_test.js
b/ambari-web/test/views/main/service/info/metrics/flume/flume_incoming_sum_test.js
new file mode 100644
index 0000000..0a20a9d
--- /dev/null
+++ b/ambari-web/test/views/main/service/info/metrics/flume/flume_incoming_sum_test.js
@@ -0,0 +1,108 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+require('views/main/service/info/metrics/flume/flume_incoming_sum');
+
+describe('App.ChartServiceMetricsFlume_IncommingSum', function () {
+
+  var view;
+
+  beforeEach(function () {
+    view = App.ChartServiceMetricsFlume_IncommingSum.create();
+  });
+
+  describe('#transformToSeries', function () {
+
+    var cases = [
+      {
+        data: {},
+        seriesArray: [],
+        title: 'empty response'
+      },
+      {
+        data: {
+          metrics: {}
+        },
+        seriesArray: [],
+        title: 'invalid response'
+      },
+      {
+        data: {
+          metrics: {
+            flume: {
+              flume: {
+                CHANNEL: {
+                  EventPutSuccessCount: {
+                    rate: null
+                  }
+                }
+              }
+            }
+          }
+        },
+        seriesArray: [],
+        title: 'empty data'
+      },
+      {
+        data: {
+          metrics: {
+            flume: {
+              flume: {
+                CHANNEL: {
+                  EventPutSuccessCount: {
+                    rate: {
+                      sum: [
+                        [0, 1445472000],
+                        [1, 1445472015]
+                      ]
+                    }
+                  }
+                }
+              }
+            }
+          }
+        },
+        seriesArray: [
+          {
+            name: Em.I18n.t('services.service.info.metrics.flume.incoming.sum'),
+            data: [
+              {
+                x: 1445472000,
+                y: 0
+              },
+              {
+                x: 1445472015,
+                y: 1
+              }
+            ]
+          }
+        ],
+        title: 'valid data'
+      }
+    ];
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        expect(view.transformToSeries(item.data)).to.eql(item.seriesArray);
+      });
+    });
+
+  });
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a10db2b/ambari-web/test/views/main/service/info/metrics/flume/flume_outgoing_mma_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/metrics/flume/flume_outgoing_mma_test.js
b/ambari-web/test/views/main/service/info/metrics/flume/flume_outgoing_mma_test.js
new file mode 100644
index 0000000..f00dde4
--- /dev/null
+++ b/ambari-web/test/views/main/service/info/metrics/flume/flume_outgoing_mma_test.js
@@ -0,0 +1,142 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+require('views/main/service/info/metrics/flume/flume_outgoing_mma');
+
+describe('App.ChartServiceMetricsFlume_OutgoingMMA', function () {
+
+  var view;
+
+  beforeEach(function () {
+    view = App.ChartServiceMetricsFlume_OutgoingMMA.create();
+  });
+
+  describe('#transformToSeries', function () {
+
+    var cases = [
+      {
+        data: {},
+        seriesArray: [],
+        title: 'empty response'
+      },
+      {
+        data: {
+          metrics: {}
+        },
+        seriesArray: [],
+        title: 'invalid response'
+      },
+      {
+        data: {
+          metrics: {
+            flume: {
+              flume: {
+                CHANNEL: {
+                  EventTakeSuccessCount: {
+                    rate: null
+                  }
+                }
+              }
+            }
+          }
+        },
+        seriesArray: [],
+        title: 'empty data'
+      },
+      {
+        data: {
+          metrics: {
+            flume: {
+              flume: {
+                CHANNEL: {
+                  EventTakeSuccessCount: {
+                    rate: {
+                      avg: [
+                        [0, 1445472000],
+                        [1, 1445472015]
+                      ],
+                      max: [
+                        [2, 1445472000],
+                        [3, 1445472015]
+                      ],
+                      min: [
+                        [4, 1445472000],
+                        [5, 1445472015]
+                      ]
+                    }
+                  }
+                }
+              }
+            }
+          }
+        },
+        seriesArray: [
+          {
+            name: Em.I18n.t('services.service.info.metrics.flume.outgoing_mma').format('avg'),
+            data: [
+              {
+                x: 1445472000,
+                y: 0
+              },
+              {
+                x: 1445472015,
+                y: 1
+              }
+            ]
+          },
+          {
+            name: Em.I18n.t('services.service.info.metrics.flume.outgoing_mma').format('max'),
+            data: [
+              {
+                x: 1445472000,
+                y: 2
+              },
+              {
+                x: 1445472015,
+                y: 3
+              }
+            ]
+          },
+          {
+            name: Em.I18n.t('services.service.info.metrics.flume.outgoing_mma').format('min'),
+            data: [
+              {
+                x: 1445472000,
+                y: 4
+              },
+              {
+                x: 1445472015,
+                y: 5
+              }
+            ]
+          }
+        ],
+        title: 'valid data'
+      }
+    ];
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        expect(view.transformToSeries(item.data)).to.eql(item.seriesArray);
+      });
+    });
+
+  });
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a10db2b/ambari-web/test/views/main/service/info/metrics/flume/flume_outgoing_sum_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/metrics/flume/flume_outgoing_sum_test.js
b/ambari-web/test/views/main/service/info/metrics/flume/flume_outgoing_sum_test.js
new file mode 100644
index 0000000..9c725d1
--- /dev/null
+++ b/ambari-web/test/views/main/service/info/metrics/flume/flume_outgoing_sum_test.js
@@ -0,0 +1,108 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+require('views/main/service/info/metrics/flume/flume_outgoing_sum');
+
+describe('App.ChartServiceMetricsFlume_OutgoingSum', function () {
+
+  var view;
+
+  beforeEach(function () {
+    view = App.ChartServiceMetricsFlume_OutgoingSum.create();
+  });
+
+  describe('#transformToSeries', function () {
+
+    var cases = [
+      {
+        data: {},
+        seriesArray: [],
+        title: 'empty response'
+      },
+      {
+        data: {
+          metrics: {}
+        },
+        seriesArray: [],
+        title: 'invalid response'
+      },
+      {
+        data: {
+          metrics: {
+            flume: {
+              flume: {
+                CHANNEL: {
+                  EventTakeSuccessCount: {
+                    rate: null
+                  }
+                }
+              }
+            }
+          }
+        },
+        seriesArray: [],
+        title: 'empty data'
+      },
+      {
+        data: {
+          metrics: {
+            flume: {
+              flume: {
+                CHANNEL: {
+                  EventTakeSuccessCount: {
+                    rate: {
+                      sum: [
+                        [0, 1445472000],
+                        [1, 1445472015]
+                      ]
+                    }
+                  }
+                }
+              }
+            }
+          }
+        },
+        seriesArray: [
+          {
+            name: Em.I18n.t('services.service.info.metrics.flume.outgoing.sum'),
+            data: [
+              {
+                x: 1445472000,
+                y: 0
+              },
+              {
+                x: 1445472015,
+                y: 1
+              }
+            ]
+          }
+        ],
+        title: 'valid data'
+      }
+    ];
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        expect(view.transformToSeries(item.data)).to.eql(item.seriesArray);
+      });
+    });
+
+  });
+
+});


Mime
View raw message