kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [3/4] kudu git commit: [webui] Fix master reg formatting and add memory use percentage.
Date Fri, 05 May 2017 20:49:26 GMT
[webui] Fix master reg formatting and add memory use percentage.

This is a little patch to fix the formatting of the master
registration. I'd done this for tserver registrations before but
forgot /masters. It also adds a % memory consumed row to
the "Process memory usage" table on /mem-trackers.

Change-Id: Ibe1f11b153f16753f94c3dae67cce97679e46dbc
Reviewed-on: http://gerrit.cloudera.org:8080/6780
Reviewed-by: Adar Dembo <adar@cloudera.com>
Tested-by: Will Berkeley <wdberkeley@gmail.com>
Reviewed-by: Alexey Serbin <aserbin@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/30d9e72c
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/30d9e72c
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/30d9e72c

Branch: refs/heads/master
Commit: 30d9e72cd504f20a5c1435c2c8dc822415756544
Parents: 7169b8b
Author: Will Berkeley <wdberkeley@apache.org>
Authored: Tue May 2 09:46:02 2017 -0700
Committer: David Ribeiro Alves <davidralves@gmail.com>
Committed: Fri May 5 20:35:51 2017 +0000

----------------------------------------------------------------------
 src/kudu/master/master-path-handlers.cc  |  2 +-
 src/kudu/server/default-path-handlers.cc | 11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/30d9e72c/src/kudu/master/master-path-handlers.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/master-path-handlers.cc b/src/kudu/master/master-path-handlers.cc
index 240335d..2f53676 100644
--- a/src/kudu/master/master-path-handlers.cc
+++ b/src/kudu/master/master-path-handlers.cc
@@ -372,7 +372,7 @@ void MasterPathHandlers::HandleMasters(const Webserver::WebRequest&
req,
     string reg_str = EscapeForHtmlToString(
         SecureShortDebugString(master.registration()));
     *output << Substitute(
-        "  <tr><td>$0</td><td>$1</td><td><code>$2</code></td></tr>\n",
+        "  <tr><td>$0</td><td>$1</td><td><pre><code>$2</code></pre></td></tr>\n",
         uuid_text,
         master.has_role() ? RaftPeerPB_Role_Name(master.role()) : "N/A",
         reg_str);

http://git-wip-us.apache.org/repos/asf/kudu/blob/30d9e72c/src/kudu/server/default-path-handlers.cc
----------------------------------------------------------------------
diff --git a/src/kudu/server/default-path-handlers.cc b/src/kudu/server/default-path-handlers.cc
index f4f9dd5..94acbbe 100644
--- a/src/kudu/server/default-path-handlers.cc
+++ b/src/kudu/server/default-path-handlers.cc
@@ -145,12 +145,19 @@ static void MemUsageHandler(const Webserver::WebRequest& req, std::ostringstream
 
 // Registered to handle "/mem-trackers", and prints out to handle memory tracker information.
 static void MemTrackersHandler(const Webserver::WebRequest& /*req*/, std::ostringstream*
output) {
+  int64_t current_consumption = process_memory::CurrentConsumption();
+  int64_t hard_limit = process_memory::HardLimit();
   *output << "<h1>Process memory usage</h1>\n";
   *output << "<table class='table table-striped'>\n";
   *output << Substitute("  <tr><th>Total consumption</th><td>$0</td></tr>\n",
-                        HumanReadableNumBytes::ToString(process_memory::CurrentConsumption()));
+                        HumanReadableNumBytes::ToString(current_consumption));
   *output << Substitute("  <tr><th>Memory limit</th><td>$0</td></tr>\n",
-                        HumanReadableNumBytes::ToString(process_memory::HardLimit()));
+                        HumanReadableNumBytes::ToString(hard_limit));
+  if (hard_limit > 0) {
+    double percentage = 100 * static_cast<double>(current_consumption / hard_limit);
+    *output << Substitute("  <tr><th>Percentage consumed</th><td>$0%</td></tr>\n",
+                          StringPrintf("%.2f", percentage));
+  }
   *output << "</table>\n";
 #ifndef TCMALLOC_ENABLED
   *output << R"(


Mime
View raw message