ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-12576. UI Ambari Storm service page shows incomplete metrics (alexantonenko)
Date Wed, 29 Jul 2015 14:07:44 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 8acac954e -> 8ad64e343


AMBARI-12576. UI Ambari Storm service page shows incomplete metrics (alexantonenko)


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

Branch: refs/heads/branch-2.1
Commit: 8ad64e3431f80a5c036d3d13bffebfc189687125
Parents: 8acac95
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Wed Jul 29 16:33:49 2015 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Wed Jul 29 17:07:38 2015 +0300

----------------------------------------------------------------------
 .../app/controllers/global/update_controller.js      |  8 +++++++-
 ambari-web/app/mappers/service_metrics_mapper.js     | 14 ++++++++++----
 .../controllers/global/update_controller_test.js     | 15 ++++++++++++++-
 3 files changed, 31 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad64e34/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index bbcd4da..34dcde1 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -454,6 +454,12 @@ App.UpdateController = Em.Controller.extend({
    */
   getConditionalFields: function () {
     var conditionalFields = [];
+    var stormMetric = 'metrics/api/v1/cluster/summary,metrics/api/v1/topology/summary,metrics/api/v1/nimbus/summary';
+    if (/^2.1/.test(App.get('currentStackVersionNumber'))) {
+      stormMetric = 'metrics/api/cluster/summary';
+    } else if (/^2.2/.test(App.get('currentStackVersionNumber'))) {
+      stormMetric = 'metrics/api/v1/cluster/summary,metrics/api/v1/topology/summary';
+    }
     var serviceSpecificParams = {
       'FLUME': "host_components/processes/HostComponentProcess",
       'YARN': "host_components/metrics/yarn/Queue," +
@@ -467,7 +473,7 @@ App.UpdateController = Em.Controller.extend({
         "host_components/metrics/hbase/master/MasterActiveTime," +
         "host_components/metrics/hbase/master/AverageLoad," +
         "host_components/metrics/master/AssignmentManger/ritCount",
-      'STORM': /^2.1/.test(App.get('currentStackVersionNumber')) ? 'metrics/api/cluster/summary'
: 'metrics/api/v1/cluster/summary,metrics/api/v1/topology/summary'
+      'STORM': stormMetric
     };
     var services = App.cache['services'];
     services.forEach(function (service) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad64e34/ambari-web/app/mappers/service_metrics_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_metrics_mapper.js b/ambari-web/app/mappers/service_metrics_mapper.js
index 1616f82..3f3b6b5 100644
--- a/ambari-web/app/mappers/service_metrics_mapper.js
+++ b/ambari-web/app/mappers/service_metrics_mapper.js
@@ -631,20 +631,26 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
       STORM_REST_API: 'metrics.api.cluster.summary',
       STORM_UI_SERVER: 'metrics.api.v1.cluster.summary'
     }[metricsInfoComponent];
+    var restApiMetrics = {};
 
     item.components.forEach(function (component) {
-      if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name
== metricsInfoComponent) {
+      var componentName = component.ServiceComponentInfo.component_name;
+      if (component.ServiceComponentInfo && componentName == metricsInfoComponent)
{
         if (Em.get(component, metricsPath)) {
-          item.restApiComponent = App.keysDottedToCamelCase(Em.get(component, metricsPath));
+          $.extend(restApiMetrics, App.keysDottedToCamelCase(Em.get(component, metricsPath)));
           if (metricsInfoComponent == 'STORM_UI_SERVER') {
-            item.restApiComponent.topologies = Em.get(component, 'metrics.api.v1.topology.summary.length');
+            restApiMetrics.topologies = Em.get(component, 'metrics.api.v1.topology.summary.length');
+            if (stringUtils.compareVersions(App.get('currentStackVersionNumber'), '2.3')
> -1) {
+              restApiMetrics.nimbusUptime = Em.getWithDefault(component, 'metrics.api.v1.nimbus.summary.0.nimbusUpTime',
Em.I18n.t('services.service.summary.notRunning'));
+            }
           } else {
-            item.restApiComponent.nimbusUptime = dateUtils.timingFormat(item.restApiComponent.nimbusUptime
* 1000);
+            restApiMetrics.nimbusUptime = dateUtils.timingFormat(restApiMetrics.nimbusUptime
* 1000);
           }
         }
         finalConfig = jQuery.extend({}, finalConfig, stormConfig);
       }
     });
+    item.restApiComponent = restApiMetrics;
     return this.parseIt(item, finalConfig);
   }
 })

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad64e34/ambari-web/test/controllers/global/update_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/update_controller_test.js b/ambari-web/test/controllers/global/update_controller_test.js
index 06edcf3..e380b86 100644
--- a/ambari-web/test/controllers/global/update_controller_test.js
+++ b/ambari-web/test/controllers/global/update_controller_test.js
@@ -137,7 +137,8 @@ describe('App.UpdateController', function () {
           }
         ],
         result: ["metrics/api/v1/cluster/summary," +
-          "metrics/api/v1/topology/summary"]
+                 "metrics/api/v1/topology/summary," +
+                 "metrics/api/v1/nimbus/summary"]
       }
     ];
 
@@ -165,6 +166,18 @@ describe('App.UpdateController', function () {
         ],
         stackVersionNumber: '2.2',
         result: ["metrics/api/v1/cluster/summary,metrics/api/v1/topology/summary"]
+      },
+      {
+        title: 'STORM service stack 2.3',
+        services: [
+          {
+            ServiceInfo: {
+              service_name: 'STORM'
+            }
+          }
+        ],
+        stackVersionNumber: '2.3',
+        result: ["metrics/api/v1/cluster/summary,metrics/api/v1/topology/summary,metrics/api/v1/nimbus/summary"]
       }
     ];
     testCases.forEach(function(test){


Mime
View raw message