ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject git commit: AMBARI-4975. Storm: Move storm's metrics data processing from Storm REST API component to Nimbus. (Buzhor Denys via akovalenko)
Date Thu, 06 Mar 2014 17:56:19 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk c36913388 -> 4746abd73


AMBARI-4975. Storm: Move storm's metrics data processing from Storm REST API component to
Nimbus. (Buzhor Denys via akovalenko)


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

Branch: refs/heads/trunk
Commit: 4746abd73f98dbaf6892b105ae8f39ef443e3167
Parents: c369133
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Thu Mar 6 19:56:01 2014 +0200
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Thu Mar 6 19:56:01 2014 +0200

----------------------------------------------------------------------
 .../mixins/common/chart/storm_linear_time.js    | 52 +++++++++++---------
 ambari-web/app/utils/ajax.js                    |  4 ++
 .../info/metrics/storm/executors_metric.js      |  2 +-
 .../info/metrics/storm/slots_number_metric.js   |  6 +--
 .../service/info/metrics/storm/tasks_metric.js  |  2 +-
 .../info/metrics/storm/topologies_metric.js     |  2 +-
 6 files changed, 39 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4746abd7/ambari-web/app/mixins/common/chart/storm_linear_time.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/chart/storm_linear_time.js b/ambari-web/app/mixins/common/chart/storm_linear_time.js
index 49d7fb1..f70db0b 100644
--- a/ambari-web/app/mixins/common/chart/storm_linear_time.js
+++ b/ambari-web/app/mixins/common/chart/storm_linear_time.js
@@ -20,33 +20,39 @@
 var App = require('app');
 
 App.StormLinearTimeChartMixin = Em.Mixin.create({
-  chartStormModel: function() {
-    return App.StormService.find().objectAt(0);
-  }.property(''),
+  ajaxIndex: 'service.metrics.storm.nimbus',
+  metricsTemplate: 'metrics/storm/nimbus/{0}[{1},{2},{3}]',
 
-  loadData: function() {
-    this._refreshGraph();
+  getDataForAjaxRequest: function() {
+    var currentTime = Math.round(App.dateTime() / 1000);
+    var metricTemplate = [];
+    this.get('stormChartDefinition').forEach(function(chartInfo) {
+      metricTemplate.push(
+        this.get('metricsTemplate').format(chartInfo.field, currentTime - this.get('timeUnitSeconds'),
currentTime, 15)
+      );
+    }, this);
+    return {
+      metricsTemplate: metricTemplate.join(',')
+    };
   },
 
-  showGraphInPopup: function() {
-    this._super();
-    var self = this;
-    // show data in popup
-    Em.run.next(function() {
-      self.set('isPopupReady', true);
+  transformToSeries: function (jsonData) {
+    var seriesArray = [];
+    var pathKeys = ['metrics','storm','nimbus'];
+    var validPath = true;
+    pathKeys.forEach(function(key) {
+      if (!jsonData[key]) {
+        validPath = false;
+      } else {
+        jsonData = jsonData[key];
+      }
     });
-  },
-
-  transformToSeries: function () {
-    return this.getMappedStormData();
-  },
-
-  getMappedStormData: function() {
-    var seriesData = [];
-    this.get('stormChartDefinition').forEach(function(item) {
-      if (this.get('chartStormModel.' + item.value) || this.get('chartStormModel.' + item.value)
== 0)
-        seriesData.push(this.transformData(this.get('chartStormModel.' + item.value), item.name));
+    if (!validPath) {
+      return seriesArray;
+    }
+    this.get('stormChartDefinition').forEach(function(chart){
+      seriesArray.push(this.transformData(jsonData[chart.field], chart.name));
     }, this);
-    return seriesData;
+    return seriesArray;
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/4746abd7/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index a48ac92..76504be 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -687,6 +687,10 @@ var urls = {
     'mock': '',
     'testInProduction': true
   },
+  'service.metrics.storm.nimbus': {
+    'real': '/clusters/{clusterName}/services/STORM/components/NIMBUS?fields={metricsTemplate}',
+    'mock': ''
+  },
   'dashboard.cluster_metrics.cpu': {
     'real': '/clusters/{clusterName}/?fields=metrics/cpu[{fromSeconds},{toSeconds},{stepSeconds}]',
     'mock': '/data/cluster_metrics/cpu_1hr.json',

http://git-wip-us.apache.org/repos/asf/ambari/blob/4746abd7/ambari-web/app/views/main/service/info/metrics/storm/executors_metric.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/metrics/storm/executors_metric.js b/ambari-web/app/views/main/service/info/metrics/storm/executors_metric.js
index 391bc69..8eea33a 100644
--- a/ambari-web/app/views/main/service/info/metrics/storm/executors_metric.js
+++ b/ambari-web/app/views/main/service/info/metrics/storm/executors_metric.js
@@ -27,7 +27,7 @@ App.ChartServiceMetricsSTORM_Executors = App.ChartLinearTimeView.extend(App.Stor
   stormChartDefinition: [
     {
       name: Em.I18n.t('services.storm.executors.metrics.total'),
-      value: 'totalExecutors'
+      field: 'totalexecutors'
     }
   ]
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4746abd7/ambari-web/app/views/main/service/info/metrics/storm/slots_number_metric.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/metrics/storm/slots_number_metric.js b/ambari-web/app/views/main/service/info/metrics/storm/slots_number_metric.js
index 420aaa5..543508b 100644
--- a/ambari-web/app/views/main/service/info/metrics/storm/slots_number_metric.js
+++ b/ambari-web/app/views/main/service/info/metrics/storm/slots_number_metric.js
@@ -27,15 +27,15 @@ App.ChartServiceMetricsSTORM_SlotsNumber = App.ChartLinearTimeView.extend(App.St
   stormChartDefinition: [
     {
       name: Em.I18n.t('services.storm.slots.metrics.total'),
-      value: 'totalSlots'
+      field: 'totalslots'
     },
     {
       name: Em.I18n.t('services.storm.slots.metrics.free'),
-      value: 'freeSlots'
+      field: 'freeslots'
     },
     {
       name: Em.I18n.t('services.storm.slots.metrics.used'),
-      value: 'usedSlots'
+      field: 'usedslots'
     }
   ]
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4746abd7/ambari-web/app/views/main/service/info/metrics/storm/tasks_metric.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/metrics/storm/tasks_metric.js b/ambari-web/app/views/main/service/info/metrics/storm/tasks_metric.js
index 80d04bc..a70d358 100644
--- a/ambari-web/app/views/main/service/info/metrics/storm/tasks_metric.js
+++ b/ambari-web/app/views/main/service/info/metrics/storm/tasks_metric.js
@@ -27,7 +27,7 @@ App.ChartServiceMetricsSTORM_Tasks = App.ChartLinearTimeView.extend(App.StormLin
   stormChartDefinition: [
     {
       name: Em.I18n.t('services.storm.tasks.metrics.total'),
-      value: 'totalTasks'
+      field: 'totaltasks'
     }
   ]
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4746abd7/ambari-web/app/views/main/service/info/metrics/storm/topologies_metric.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/metrics/storm/topologies_metric.js b/ambari-web/app/views/main/service/info/metrics/storm/topologies_metric.js
index 4cffbc5..d831453 100644
--- a/ambari-web/app/views/main/service/info/metrics/storm/topologies_metric.js
+++ b/ambari-web/app/views/main/service/info/metrics/storm/topologies_metric.js
@@ -27,7 +27,7 @@ App.ChartServiceMetricsSTORM_Topologies = App.ChartLinearTimeView.extend(App.Sto
   stormChartDefinition: [
     {
       name: Em.I18n.t('services.storm.topology.metrics.total'),
-      value: 'topologies'
+      field: 'topologies'
     }
   ]
 


Mime
View raw message