Skip to content

Commit

Permalink
Add port in web ui tables, add role and table name to /tablet page
Browse files Browse the repository at this point in the history
Couple of improvements to web ui:
1. The RaftConfig column in the tablet table on master and tserver now
displays the port as well as the hostname for the tablet.
2. The /tablet page displays the tablet role and the table name.

Change-Id: Ia80b74346cae1a75d66b400521e07aa1994d1d65
Reviewed-on: http://gerrit.cloudera.org:8080/3553
Tested-by: Kudu Jenkins
Reviewed-by: Jean-Daniel Cryans <[email protected]>
  • Loading branch information
wdberkeley authored and jdcryans committed Jul 15, 2016
1 parent d0cff25 commit 17e2ae5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/kudu/master/master-path-handlers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,12 @@ string MasterPathHandlers::TSDescriptorToHtml(const TSDescriptor& desc,
desc.GetRegistration(&reg);

if (reg.http_addresses().size() > 0) {
return Substitute("<a href=\"http://$0:$1/tablet?id=$2\">$3</a>",
return Substitute("<a href=\"http://$0:$1/tablet?id=$2\">$3:$4</a>",
reg.http_addresses(0).host(),
reg.http_addresses(0).port(),
EscapeForHtmlToString(tablet_id),
EscapeForHtmlToString(reg.http_addresses(0).host()));
EscapeForHtmlToString(reg.http_addresses(0).host()),
reg.http_addresses(0).port());
} else {
return EscapeForHtmlToString(desc.permanent_uuid());
}
Expand Down
10 changes: 8 additions & 2 deletions src/kudu/tserver/tserver-path-handlers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,10 @@ string TabletServerPathHandlers::ConsensusStatePBToHtml(const ConsensusStatePB&
std::sort(sorted_peers.begin(), sorted_peers.end(), &CompareByMemberType);
for (const RaftPeerPB& peer : sorted_peers) {
string peer_addr_or_uuid =
peer.has_last_known_addr() ? peer.last_known_addr().host() : peer.permanent_uuid();
peer.has_last_known_addr() ? Substitute("$0:$1",
peer.last_known_addr().host(),
peer.last_known_addr().port())
: peer.permanent_uuid();
peer_addr_or_uuid = EscapeForHtmlToString(peer_addr_or_uuid);
string role_name = RaftPeerPB::Role_Name(GetConsensusRole(peer.permanent_uuid(), cstate));
string formatted = Substitute("$0: $1", role_name, peer_addr_or_uuid);
Expand Down Expand Up @@ -314,8 +317,11 @@ void TabletServerPathHandlers::HandleTabletPage(const Webserver::WebRequest& req
if (!LoadTablet(tserver_, req, &tablet_id, &peer, output)) return;

string table_name = peer->tablet_metadata()->table_name();
RaftPeerPB::Role role = peer->consensus()->role();

*output << "<h1>Tablet " << EscapeForHtmlToString(tablet_id) << "</h1>\n";
*output << "<h1>Tablet " << EscapeForHtmlToString(tablet_id)
<< " (" << RaftPeerPB::Role_Name(role) << ")</h1>\n";
*output << "<h3>Table " << EscapeForHtmlToString(table_name) << "</h3>";

// Output schema in tabular format.
*output << "<h2>Schema</h2>\n";
Expand Down

0 comments on commit 17e2ae5

Please sign in to comment.