incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srima...@apache.org
Subject git commit: AMBARI-3115. HBase Read/Write request metrics seem to have changed for 2.x stack. (srimanth)
Date Fri, 06 Sep 2013 18:18:51 GMT
Updated Branches:
  refs/heads/trunk c8a6cbd38 -> 8682a95e4


AMBARI-3115. HBase Read/Write request metrics seem to have changed for 2.x stack. (srimanth)


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

Branch: refs/heads/trunk
Commit: 8682a95e45f37b9fe4dadf5c03b8e38df3700cda
Parents: c8a6cbd
Author: Srimanth Gunturi <sgunturi@hortonworks.com>
Authored: Thu Sep 5 13:05:35 2013 -0700
Committer: Srimanth Gunturi <sgunturi@hortonworks.com>
Committed: Fri Sep 6 11:18:33 2013 -0700

----------------------------------------------------------------------
 ambari-web/app/messages.js                      |  1 +
 .../app/views/common/chart/linear_time.js       | 63 ++++++++++++++------
 .../metrics/hbase/regionserver_rw_requests.js   |  9 ++-
 .../info/metrics/hdfs/file_operations.js        |  2 +
 4 files changed, 56 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/8682a95e/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 4209791..0c1093e 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -927,6 +927,7 @@ Em.I18n.translations = {
   'services.service.info.metrics.hbase.regionServerRegions':'RegionServer Regions',
   'services.service.info.metrics.hbase.regionServerRegions.displayNames.regions':'Regions',
   'services.service.info.metrics.hbase.regionServerRequests':'Cumulative Requests',
+  'services.service.info.metrics.hbase.regionServerRequests.2':'RegionServer Requests',
   'services.service.info.metrics.hbase.regionServerRequests.displayNames.writeRequests':'Write
Requests',
   'services.service.info.metrics.hbase.regionServerRequests.displayNames.readRequests':'Read
Requests',
 

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/8682a95e/ambari-web/app/views/common/chart/linear_time.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/chart/linear_time.js b/ambari-web/app/views/common/chart/linear_time.js
index 44f5ffb..e0e892d 100644
--- a/ambari-web/app/views/common/chart/linear_time.js
+++ b/ambari-web/app/views/common/chart/linear_time.js
@@ -271,28 +271,13 @@ App.ChartLinearTimeView = Ember.View.extend({
   /**
    * Provides the formatter to use in displaying Y axis.
    *
-   * The default is Rickshaw.Fixtures.Number.formatKMBT which shows 10K,
+   * Uses the App.ChartLinearTimeView.DefaultFormatter which shows 10K,
    * 300M etc.
    *
    * @type Function
    */
   yAxisFormatter: function(y) {
-    if(isNaN(y)){
-      return 0;
-    }
-    var value = Rickshaw.Fixtures.Number.formatKMBT(y);
-    if (value == '') return '0';
-    value = String(value);
-    var c = value[value.length - 1];
-    if (!isNaN(parseInt(c))) {
-      // c is digit
-      value = parseFloat(value).toFixed(3).replace(/0+$/, '').replace(/\.$/, '');
-    }
-    else {
-      // c in not digit
-      value = parseFloat(value.substr(0, value.length - 1)).toFixed(3).replace(/0+$/, '').replace(/\.$/,
'') + c;
-    }
-    return value;
+    return App.ChartLinearTimeView.DefaultFormatter(y);
   },
 
   /**
@@ -850,4 +835,48 @@ App.ChartLinearTimeView.TimeElapsedFormatter = function (millis) {
     }
   }
   return value;
+};
+
+/**
+ * The default formatter which uses Rickshaw.Fixtures.Number.formatKMBT 
+ * which shows 10K, 300M etc.
+ *
+ * @type Function
+ */
+App.ChartLinearTimeView.DefaultFormatter = function(y) {
+  if(isNaN(y)){
+    return 0;
+  }
+  var value = Rickshaw.Fixtures.Number.formatKMBT(y);
+  if (value == '') return '0';
+  value = String(value);
+  var c = value[value.length - 1];
+  if (!isNaN(parseInt(c))) {
+    // c is digit
+    value = parseFloat(value).toFixed(3).replace(/0+$/, '').replace(/\.$/, '');
+  }
+  else {
+    // c in not digit
+    value = parseFloat(value.substr(0, value.length - 1)).toFixed(3).replace(/0+$/, '').replace(/\.$/,
'') + c;
+  }
+  return value;
+};
+
+
+/**
+ * Creates and returns a formatter that can convert a 'value' 
+ * to 'value units/s'. 
+ * 
+ * @param unitsPrefix Prefix which will be used in 'unitsPrefix/s'
+ * @param valueFormatter  Value itself will need further processing 
+ *        via provided formatter. Ex: '10M requests/s'. Generally
+ *        should be App.ChartLinearTimeView.DefaultFormatter. 
+ * @return Function
+ */
+App.ChartLinearTimeView.CreateRateFormatter = function (unitsPrefix, valueFormatter) {
+  var suffix = " "+unitsPrefix+"/s";
+  return function (value) {
+    value = valueFormatter(value) + suffix;
+    return value;
+  };
 };
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/8682a95e/ambari-web/app/views/main/service/info/metrics/hbase/regionserver_rw_requests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/metrics/hbase/regionserver_rw_requests.js
b/ambari-web/app/views/main/service/info/metrics/hbase/regionserver_rw_requests.js
index d0fc998..8f159cf 100644
--- a/ambari-web/app/views/main/service/info/metrics/hbase/regionserver_rw_requests.js
+++ b/ambari-web/app/views/main/service/info/metrics/hbase/regionserver_rw_requests.js
@@ -28,10 +28,15 @@ var App = require('app');
  */
 App.ChartServiceMetricsHBASE_RegionServerReadWriteRequests = App.ChartLinearTimeView.extend({
   id: "service-metrics-hbase-regionserver-rw-requests",
-  title: Em.I18n.t('services.service.info.metrics.hbase.regionServerRequests'),
   renderer: 'line',
-
   ajaxIndex: 'service.metrics.hbase.regionserver_rw_requests',
+  yAxisFormatter: App.ChartLinearTimeView.CreateRateFormatter('req', 
+      App.ChartLinearTimeView.DefaultFormatter),
+  title: function () {
+    return App.get('isHadoop2Stack') ? 
+        Em.I18n.t('services.service.info.metrics.hbase.regionServerRequests.2') : 
+          Em.I18n.t('services.service.info.metrics.hbase.regionServerRequests');
+  }.property('App.isHadoop2Stack'),
 
   transformToSeries: function (jsonData) {
     var seriesArray = [];

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/8682a95e/ambari-web/app/views/main/service/info/metrics/hdfs/file_operations.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/metrics/hdfs/file_operations.js b/ambari-web/app/views/main/service/info/metrics/hdfs/file_operations.js
index 1baf90a..ceae042 100644
--- a/ambari-web/app/views/main/service/info/metrics/hdfs/file_operations.js
+++ b/ambari-web/app/views/main/service/info/metrics/hdfs/file_operations.js
@@ -32,6 +32,8 @@ App.ChartServiceMetricsHDFS_FileOperations = App.ChartLinearTimeView.extend({
   renderer: 'line',
 
   ajaxIndex: 'service.metrics.hdfs.file_operations',
+  yAxisFormatter: App.ChartLinearTimeView.CreateRateFormatter('ops', 
+      App.ChartLinearTimeView.DefaultFormatter),
 
   transformToSeries: function (jsonData) {
     var seriesArray = [];


Mime
View raw message