kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [1/4] kudu git commit: [web-ui] KUDU-1619 Separate tables for live and dead tservers on /tablet-servers
Date Fri, 23 Sep 2016 19:10:12 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 21aa44398 -> c5b07fa8f


[web-ui] KUDU-1619 Separate tables for live and dead tservers on /tablet-servers

Creating two lists of tservers live and dead.
Created a function to generate html tables taking server list and table header as params.

Attached sampe screenshot:
https://github.com/ninadshr/sample_repo/blob/master/tablet_servers.png

Change-Id: I479fad5c2db61949f7d67bde7901e7a59c60b786
Reviewed-on: http://gerrit.cloudera.org:8080/4450
Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
Tested-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/376f95b6
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/376f95b6
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/376f95b6

Branch: refs/heads/master
Commit: 376f95b6dc19ceb13221f02851cf58366f71825d
Parents: 21aa443
Author: ninadshr <ninad@cloudera.com>
Authored: Tue Sep 20 10:46:11 2016 -0400
Committer: Alexey Serbin <aserbin@cloudera.com>
Committed: Fri Sep 23 05:23:46 2016 +0000

----------------------------------------------------------------------
 src/kudu/master/master-path-handlers.cc | 35 +++++++++++++++++++---------
 1 file changed, 24 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/376f95b6/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 4a2eff1..f85e5c8 100644
--- a/src/kudu/master/master-path-handlers.cc
+++ b/src/kudu/master/master-path-handlers.cc
@@ -74,22 +74,26 @@ void MasterPathHandlers::HandleTabletServers(const Webserver::WebRequest&
req,
   *output << Substitute("<p>There are $0 registered tablet servers.</p>",
descs.size());
 
   map<string, array<int, 2>> version_counts;
-  vector<string> tserver_rows;
+  vector<string> live_tserver_rows;
+  vector<string> dead_tserver_rows;
   for (const std::shared_ptr<TSDescriptor>& desc : descs) {
     const string time_since_hb = StringPrintf("%.1fs", desc->TimeSinceHeartbeat().ToSeconds());
     ServerRegistrationPB reg;
     desc->GetRegistration(&reg);
 
+    string row = Substitute("<tr><th>$0</th><td>$1</td><td><pre><code>$2</code></pre></td></tr>\n",
+                            RegistrationToHtml(reg, desc->permanent_uuid()),
+                            time_since_hb,
+                            EscapeForHtmlToString(reg.ShortDebugString()));
+
     if (desc->PresumedDead()) {
       version_counts[reg.software_version()][1]++;
+      dead_tserver_rows.push_back(row);
     } else {
       version_counts[reg.software_version()][0]++;
+      live_tserver_rows.push_back(row);
     }
-    string row = Substitute("<tr><th>$0</th><td>$1</td><td><pre><code>$2</code></pre></td></tr>\n",
-                            RegistrationToHtml(reg, desc->permanent_uuid()),
-                            time_since_hb,
-                            EscapeForHtmlToString(reg.ShortDebugString()));
-    tserver_rows.push_back(row);
+
   }
 
   *output << "<h3>Version Summary</h3>";
@@ -101,11 +105,20 @@ void MasterPathHandlers::HandleTabletServers(const Webserver::WebRequest&
req,
   }
   *output << "</table>";
 
-  *output << "<h3>Registrations</h3>";
-  *output << "<table class='table table-striped'>\n";
-  *output << "<tr><th>UUID</th><th>Time since heartbeat</th><th>Registration</th></tr>\n";
-  *output << JoinStrings(tserver_rows, "\n");
-  *output << "</table>\n";
+  *output << "<h3>" << "Registrations" << "</h3>\n";
+  auto generate_table = [](const vector<string>& rows,
+                           const string& header,
+                           ostream* output) {
+    if (!rows.empty()) {
+      *output << "<h4>" << header << "</h4>\n";
+      *output << "<table class='table table-striped'>\n";
+      *output << "<tr><th>UUID</th><th>Time since heartbeat</th><th>Registration</th></tr>\n";
+      *output << JoinStrings(rows, "\n");
+      *output << "</table>\n";
+    }
+  };
+  generate_table(live_tserver_rows, "Live Tablet Servers", output);
+  generate_table(dead_tserver_rows, "Dead Tablet Servers", output);
 }
 
 void MasterPathHandlers::HandleCatalogManager(const Webserver::WebRequest& req,


Mime
View raw message