Browse Source

AMBARI-1620. Add heatmaps for Host and Hbase section. (jaimin)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1456298 13f79535-47bb-0310-9956-ffa450edef68
Jaimin Jetly 12 years ago
parent
commit
d907f1ee96

+ 2 - 0
CHANGES.txt

@@ -11,6 +11,8 @@ Trunk (unreleased changes):
  INCOMPATIBLE CHANGES 
 
  NEW FEATURES
+
+ AMBARI-1620. Add heatmaps for Host and Hbase section. (jaimin)
  
  AMBARI-1634. Integrate Frontend Security work to enable security on
  Oozie, Hive, and WebHCat Server. (jaimin)

+ 7 - 0
ambari-web/app/controllers.js

@@ -54,6 +54,7 @@ require('controllers/main/charts');
 require('controllers/main/charts/heatmap_metrics/heatmap_metric');
 require('controllers/main/charts/heatmap_metrics/heatmap_metric_processrun');
 require('controllers/main/charts/heatmap_metrics/heatmap_metric_diskspaceused');
+require('controllers/main/charts/heatmap_metrics/heatmap_metric_cpuWaitIO');
 require('controllers/main/charts/heatmap_metrics/heatmap_metric_memoryused');
 require('controllers/main/charts/heatmap_metrics/heatmap_metric_dfs');
 require('controllers/main/charts/heatmap_metrics/heatmap_metric_dfs_bytesread');
@@ -65,6 +66,12 @@ require('controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_gctime
 require('controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_mapsRunning');
 require('controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_reducesRunning');
 require('controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_memHeapUsed');
+require('controllers/main/charts/heatmap_metrics/heatmap_metric_hbase');
+require('controllers/main/charts/heatmap_metrics/heatmap_metric_hbase_readrequest');
+require('controllers/main/charts/heatmap_metrics/heatmap_metric_hbase_writerequest');
+require('controllers/main/charts/heatmap_metrics/heatmap_metric_hbase_compactionqueue');
+require('controllers/main/charts/heatmap_metrics/heatmap_metric_hbase_regions');
+require('controllers/main/charts/heatmap_metrics/heatmap_metric_hbase_memstoresize');
 require('controllers/main/charts/heatmap');
 require('controllers/main/apps_controller');
 require('controllers/main/apps/item_controller');

+ 37 - 15
ambari-web/app/controllers/main/charts/heatmap.js

@@ -5,9 +5,9 @@
  * 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
@@ -19,41 +19,63 @@ var App = require('app');
 
 App.MainChartsHeatmapController = Em.Controller.extend({
   name: 'mainChartsHeatmapController',
-  cluster: function() {
+  cluster: function () {
     return App.Cluster.find().objectAt(0);
   }.property(''),
-  allMetrics: function(){
+  allMetrics: function () {
     var metrics = [
       Em.Object.create({
         label: Em.I18n.t('charts.heatmap.category.host'),
         category: 'host',
-        items: [ App.MainChartHeatmapDiskSpaceUsedMetric.create(),
-          App.MainChartHeatmapMemoryUsedMetric.create()
-          /*, App.MainChartHeatmapProcessRunMetric.create()*/ ]
+        items: [
+          App.MainChartHeatmapDiskSpaceUsedMetric.create(),
+          App.MainChartHeatmapMemoryUsedMetric.create(),
+          App.MainChartHeatmapCpuWaitIOMetric.create()
+          /*, App.MainChartHeatmapProcessRunMetric.create()*/
+        ]
       }),
       Em.Object.create({
         label: Em.I18n.t('charts.heatmap.category.hdfs'),
         category: 'hdfs',
-        items: [ App.MainChartHeatmapDFSBytesReadMetric.create(),
+        items: [
+          App.MainChartHeatmapDFSBytesReadMetric.create(),
           App.MainChartHeatmapDFSBytesWrittenMetric.create(),
           App.MainChartHeatmapDFSGCTimeMillisMetric.create(),
-          App.MainChartHeatmapDFSMemHeapUsedMetric.create() ]
-      }),
+          App.MainChartHeatmapDFSMemHeapUsedMetric.create()
+        ]
+      })
     ];
 
-    if(App.MapReduceService.find().get('length')) {
+    if (App.MapReduceService.find().get('length')) {
       metrics.push(
         Em.Object.create({
           label: Em.I18n.t('charts.heatmap.category.mapreduce'),
           category: 'mapreduce',
-          items: [ App.MainChartHeatmapMapreduceMapsRunningMetric.create(),
+          items: [
+            App.MainChartHeatmapMapreduceMapsRunningMetric.create(),
             App.MainChartHeatmapMapreduceReducesRunningMetric.create(),
             App.MainChartHeatmapMapreduceGCTimeMillisMetric.create(),
-            App.MainChartHeatmapMapreduceMemHeapUsedMetric.create() ]
+            App.MainChartHeatmapMapreduceMemHeapUsedMetric.create()
+          ]
         })
       );
     }
 
+    if (App.HBaseService.find().get('length')) {
+      metrics.push(
+        Em.Object.create({
+          label: Em.I18n.t('charts.heatmap.category.hbase'),
+          category: 'hbase',
+          items: [
+            App.MainChartHeatmapHbaseReadReqCount.create(),
+            App.MainChartHeatmapHbaseWriteReqCount.create(),
+            App.MainChartHeatmapHbaseCompactionQueueSize.create(),
+            App.MainChartHeatmapHbaseRegions.create(),
+            App.MainChartHeatmapHbaseMemStoreSize.create()
+          ]
+        })
+      );
+    }
     return metrics;
   }.property(),
 
@@ -62,7 +84,7 @@ App.MainChartsHeatmapController = Em.Controller.extend({
    *  route on host detail page
    * @param event
    */
-  routeHostDetail: function(event){
+  routeHostDetail: function (event) {
     App.router.transitionTo('main.hosts.hostDetails.summary', event.context)
   },
   showHeatMapMetric: function (event) {
@@ -85,7 +107,7 @@ App.MainChartsHeatmapController = Em.Controller.extend({
 
   /**
    * return class name for to be used for containing each rack.
-   * 
+   *
    * @this App.MainChartsHeatmapController
    */
   rackClass: function () {

+ 1 - 1
ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric.js

@@ -311,4 +311,4 @@ App.MainChartHeatmapMetric = Em.Object.extend({
     }
     return num;
   }
-})
+});

+ 39 - 0
ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_cpuWaitIO.js

@@ -0,0 +1,39 @@
+/**
+ * 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');
+
+/**
+ *
+ */
+App.MainChartHeatmapCpuWaitIOMetric = App.MainChartHeatmapMetric.extend({
+  name: Em.I18n.t('charts.heatmap.metrics.cpuWaitIO'),
+  maximumValue: 100,
+  defaultMetric: 'metrics.cpu.cpu_wio',
+  units: '%',
+  slotDefinitionLabelSuffix: '%',
+  metricMapper: function (json) {
+    var map = this._super(json);
+    for ( var host in map) {
+      if (host in map) {
+        var val = map[host];
+        map[host] = (val * 100).toFixed(1);
+      }
+    }
+    return map;
+  }
+});

+ 1 - 1
ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_diskspaceused.js

@@ -51,4 +51,4 @@ App.MainChartHeatmapDiskSpaceUsedMetric = App.MainChartHeatmapMetric.extend({
     }
     return hostToValueMap;
   }
-})
+});

+ 63 - 0
ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_hbase.js

@@ -0,0 +1,63 @@
+/**
+ * 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');
+
+/**
+ * Base class for any HDFS metric.
+ */
+App.MainChartHeatmapHbaseMetrics = App.MainChartHeatmapMetric.extend({
+  metricUrlTemplate: "/clusters/{clusterName}/services/HBASE/components/HBASE_REGIONSERVER?fields=host_components/{metricName}",
+
+  /**
+   * Custom mapper for DFS metrics
+   */
+  metricMapper: function (json) {
+    var hostToValueMap = {};
+    var metricName = this.get('defaultMetric');
+    if (json.host_components) {
+      var props = metricName.split('.');
+      transformValueFunction = this.get('transformValue');
+      json.host_components.forEach(function (hc) {
+        var value = hc;
+        props.forEach(function (prop) {
+          if (value != null && prop in value) {
+            value = value[prop];
+          } else {
+            value = null;
+          }
+        });
+        if (value != null) {
+          if (transformValueFunction) {
+            value = transformValueFunction(value);
+          }
+          var hostName = hc.HostRoles.host_name;
+          hostToValueMap[hostName] = value;
+        }
+      });
+    }
+    return hostToValueMap;
+  },
+
+  /**
+   * Utility function which allows extending classes to transform the value
+   * assigned to a host.
+   *
+   * @type Function
+   */
+  tranformValue: null
+});

+ 29 - 0
ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_hbase_compactionqueue.js

@@ -0,0 +1,29 @@
+/**
+ * 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');
+
+/**
+ *
+ */
+App.MainChartHeatmapHbaseCompactionQueueSize = App.MainChartHeatmapHbaseMetrics.extend({
+  name: Em.I18n.t('charts.heatmap.metrics.HbaseRegionServerCompactionQueueSize'),
+  maximumValue: 10,
+  defaultMetric: 'metrics.hbase.regionserver.compactionQueueSize',
+  units: ' ',
+  slotDefinitionLabelSuffix: ' '
+});

+ 29 - 0
ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_hbase_memstoresize.js

@@ -0,0 +1,29 @@
+/**
+ * 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');
+
+/**
+ *
+ */
+App.MainChartHeatmapHbaseMemStoreSize = App.MainChartHeatmapHbaseMetrics.extend({
+  name: Em.I18n.t('charts.heatmap.metrics.HbaseRegionServerMemStoreSize'),
+  maximumValue: 100,
+  defaultMetric: 'metrics.hbase.regionserver.memstoreSizeMB',
+  units: 'MB',
+  slotDefinitionLabelSuffix: 'MB'
+});

+ 29 - 0
ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_hbase_readrequest.js

@@ -0,0 +1,29 @@
+/**
+ * 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');
+
+/**
+ *
+ */
+App.MainChartHeatmapHbaseReadReqCount = App.MainChartHeatmapHbaseMetrics.extend({
+  name: Em.I18n.t('charts.heatmap.metrics.HbaseRegionServerReadCount'),
+  maximumValue: 200,
+  defaultMetric: 'metrics.hbase.regionserver.readRequestsCount',
+  units: '',
+  slotDefinitionLabelSuffix: ' '
+});

+ 29 - 0
ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_hbase_regions.js

@@ -0,0 +1,29 @@
+/**
+ * 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');
+
+/**
+ *
+ */
+App.MainChartHeatmapHbaseRegions = App.MainChartHeatmapHbaseMetrics.extend({
+  name: Em.I18n.t('charts.heatmap.metrics.HbaseRegionServerRegions'),
+  maximumValue: 10,
+  defaultMetric: 'metrics.hbase.regionserver.regions',
+  units: 'regions',
+  slotDefinitionLabelSuffix: 'region'
+});

+ 29 - 0
ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_hbase_writerequest.js

@@ -0,0 +1,29 @@
+/**
+ * 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');
+
+/**
+ *
+ */
+App.MainChartHeatmapHbaseWriteReqCount = App.MainChartHeatmapHbaseMetrics.extend({
+  name: Em.I18n.t('charts.heatmap.metrics.HbaseRegionServerWriteCount'),
+  maximumValue: 200,
+  defaultMetric: 'metrics.hbase.regionserver.writeRequestsCount',
+  units: 'counts',
+  slotDefinitionLabelSuffix: ' '
+});

+ 7 - 1
ambari-web/app/messages.js

@@ -792,6 +792,7 @@ Em.I18n.translations = {
   'charts.heatmap.item.host.process':'Total Running Processes',
   'charts.heatmap.category.hdfs':'HDFS',
   'charts.heatmap.category.mapreduce': 'MapReduce',
+  'charts.heatmap.category.hbase': 'HBase',
   'charts.heatmap.unknown': 'Unknown',
   'charts.heatmap.label.notApplicable' :'Not Applicable',
   'charts.heatmap.label.invalidData' :'Invalid data',
@@ -806,7 +807,12 @@ Em.I18n.translations = {
   'charts.heatmap.metrics.reducesRunning' :'Reduces Running',
   'charts.heatmap.metrics.memoryUsed' :'Memory Used %',
   'charts.heatmap.metrics.processRun' :'Total Running Processes',
-
+  'charts.heatmap.metrics.cpuWaitIO':'CPU Wait I/O %',
+  'charts.heatmap.metrics.HbaseRegionServerReadCount': 'RegionServer read request count',
+  'charts.heatmap.metrics.HbaseRegionServerWriteCount': 'RegionServer write request count',
+  'charts.heatmap.metrics.HbaseRegionServerCompactionQueueSize': 'RegionServer compaction queue size',
+  'charts.heatmap.metrics.HbaseRegionServerRegions': 'RegionServer regions',
+  'charts.heatmap.metrics.HbaseRegionServerMemStoreSize': 'RegionServer memstore sizes',
   'metric.notFound':'no items found',
   'metric.default':'combined',
   'metric.cpu':'cpu',