diff --git a/src/yb/server/server_base.cc b/src/yb/server/server_base.cc index a1e3b42aa0e4..8809cf7e091f 100644 --- a/src/yb/server/server_base.cc +++ b/src/yb/server/server_base.cc @@ -95,6 +95,7 @@ using std::string; using std::stringstream; using std::vector; using strings::Substitute; +using namespace std::placeholders; namespace yb { namespace server { @@ -424,9 +425,9 @@ std::string RpcAndWebServerBase::FooterHtml() const { instance_pb_->permanent_uuid()); } -static void DisplayIconTile(std::stringstream* output, const string icon, - const string caption, const string url) { - *output << "
\n" +void RpcAndWebServerBase::DisplayIconTile(std::stringstream* output, const string icon, + const string caption, const string url) { + *output << "
\n" << " \n" << "
\n" << " \n" @@ -435,30 +436,38 @@ static void DisplayIconTile(std::stringstream* output, const string icon, << "

" << caption << "

\n" << "
\n" << "
\n" - << "
\n"; + << "
\n"; } -static void HandleDebugPage(const Webserver::WebRequest& req, stringstream* output) { +void RpcAndWebServerBase::DisplayRpcIcons(std::stringstream* output) { + // RPCs in Progress. + DisplayIconTile(output, "fa-tasks", "Server RPCs", "/rpcz"); +} + +Status RpcAndWebServerBase::HandleDebugPage(const Webserver::WebRequest& req, + stringstream* output) { *output << "

Debug Utilities

\n"; *output << "
\n"; - + *output << "

General Info

"; // Logs. DisplayIconTile(output, "fa-files-o", "Logs", "/logs"); // GFlags. DisplayIconTile(output, "fa-flag-o", "GFlags", "/varz"); // Memory trackers. DisplayIconTile(output, "fa-bar-chart", "Memory Breakdown", "/mem-trackers"); + // Total memory. + DisplayIconTile(output, "fa-cog", "Total Memory", "/memz"); // Metrics. DisplayIconTile(output, "fa-line-chart", "Metrics", "/metrics"); - // RPCs in progress. - DisplayIconTile(output, "fa-tasks", "RPCs In Progress", "/rpcz"); // Threads. DisplayIconTile(output, "fa-list-ul", "Threads", "/threadz"); - // Total memory. - DisplayIconTile(output, "fa-cog", "Total Memory", "/memz"); - *output << "
\n"; + *output << "

RPCs In Progress

"; + *output << "
\n"; + DisplayRpcIcons(output); + *output << "
\n"; + return Status::OK(); } Status RpcAndWebServerBase::Start() { @@ -468,7 +477,8 @@ Status RpcAndWebServerBase::Start() { AddRpczPathHandlers(messenger_, web_server_.get()); RegisterMetricsJsonHandler(web_server_.get(), metric_registry_.get()); TracingPathHandlers::RegisterHandlers(web_server_.get()); - web_server_->RegisterPathHandler("/utilz", "Utilities", HandleDebugPage, + web_server_->RegisterPathHandler("/utilz", "Utilities", + std::bind(&RpcAndWebServerBase::HandleDebugPage, this, _1, _2), true, true, "fa fa-wrench"); web_server_->set_footer_html(FooterHtml()); RETURN_NOT_OK(web_server_->Start()); diff --git a/src/yb/server/server_base.h b/src/yb/server/server_base.h index ac9608d8a53f..465a2f07a0c8 100644 --- a/src/yb/server/server_base.h +++ b/src/yb/server/server_base.h @@ -167,6 +167,13 @@ class RpcAndWebServerBase : public RpcServerBase { rpc::ConnectionContextFactoryPtr connection_context_factory); virtual ~RpcAndWebServerBase(); + virtual Status HandleDebugPage(const Webserver::WebRequest& req, std::stringstream* output); + + virtual void DisplayRpcIcons(std::stringstream* output); + + static void DisplayIconTile(std::stringstream* output, const string icon, const string caption, + const string url); + CHECKED_STATUS Init(); CHECKED_STATUS Start(); void Shutdown(); diff --git a/src/yb/tserver/tablet_server.cc b/src/yb/tserver/tablet_server.cc index 2572bc6902f6..46cfe035a822 100644 --- a/src/yb/tserver/tablet_server.cc +++ b/src/yb/tserver/tablet_server.cc @@ -55,6 +55,7 @@ #include "yb/util/net/sockaddr.h" #include "yb/util/size_literals.h" #include "yb/util/status.h" +#include "yb/gutil/strings/split.h" using std::make_shared; using std::shared_ptr; @@ -102,6 +103,15 @@ DEFINE_bool(enable_direct_local_tablet_server_call, "Enable direct call to local tablet server"); TAG_FLAG(enable_direct_local_tablet_server_call, advanced); +DEFINE_string(redis_proxy_bind_address, "", "Address to bind the redis proxy to"); +DEFINE_int32(redis_proxy_webserver_port, 0, "Webserver port for redis proxy"); + +DEFINE_string(cql_proxy_bind_address, "", "Address to bind the CQL proxy to"); +DEFINE_int32(cql_proxy_webserver_port, 0, "Webserver port for CQL proxy"); + +DEFINE_string(pgsql_proxy_bind_address, "", "Address to bind the PostgreSQL proxy to"); +DEFINE_int32(pgsql_proxy_webserver_port, 0, "Webserver port for PostgreSQL proxy"); + DECLARE_int64(inbound_rpc_block_size); DECLARE_int64(inbound_rpc_memory_limit); @@ -299,5 +309,33 @@ TabletServiceImpl* TabletServer::tablet_server_service() { return tablet_server_service_; } +string GetDynamicUrlTile(const string path, const string host, const int port) { + + vector parsed_hostname = strings::Split(host, ":"); + std::string link = strings::Substitute("http://$0:$1$2", + parsed_hostname[0], yb::ToString(port), path); + return link; +} + +void TabletServer::DisplayRpcIcons(std::stringstream* output) { + // RPCs in Progress. + DisplayIconTile(output, "fa-tasks", "TServer RPCs", "/rpcz"); + // Cassandra RPCs in Progress. + string cass_url = GetDynamicUrlTile("/rpcz", FLAGS_cql_proxy_bind_address, + FLAGS_cql_proxy_webserver_port); + DisplayIconTile(output, "fa-tasks", "Cassandra RPCs", cass_url); + + // Redis RPCs in Progress. + string redis_url = GetDynamicUrlTile("/rpcz", FLAGS_redis_proxy_bind_address, + FLAGS_redis_proxy_webserver_port); + DisplayIconTile(output, "fa-tasks", "Redis RPCs", redis_url); + + // PGSQL RPCs in Progress. + string sql_url = GetDynamicUrlTile("/rpcz", FLAGS_pgsql_proxy_bind_address, + FLAGS_pgsql_proxy_webserver_port); + DisplayIconTile(output, "fa-tasks", "SQL RPCs", sql_url); + +} + } // namespace tserver } // namespace yb diff --git a/src/yb/tserver/tablet_server.h b/src/yb/tserver/tablet_server.h index 2fb418bbf8c6..fc50098a32b3 100644 --- a/src/yb/tserver/tablet_server.h +++ b/src/yb/tserver/tablet_server.h @@ -154,6 +154,8 @@ class TabletServer : public server::RpcAndWebServerBase, public TabletServerIf { protected: friend class TabletServerTestBase; + void DisplayRpcIcons(std::stringstream* output) override; + CHECKED_STATUS ValidateMasterAddressResolution() const; bool initted_; diff --git a/src/yb/tserver/tablet_server_main.cc b/src/yb/tserver/tablet_server_main.cc index 8258b1482f61..c308b78dbb76 100644 --- a/src/yb/tserver/tablet_server_main.cc +++ b/src/yb/tserver/tablet_server_main.cc @@ -66,27 +66,31 @@ using yb::pgserver::PgServer; using yb::pgserver::PgServerOptions; DEFINE_bool(start_redis_proxy, true, "Starts a redis proxy along with the tablet server"); -DEFINE_string(redis_proxy_bind_address, "", "Address to bind the redis proxy to"); -DEFINE_int32(redis_proxy_webserver_port, 0, "Webserver port for redis proxy"); DEFINE_bool(start_cql_proxy, true, "Starts a CQL proxy along with the tablet server"); DEFINE_string(cql_proxy_broadcast_rpc_address, "", "RPC address to broadcast to other nodes. This is the broadcast_address used in the" " system.local table"); -DEFINE_string(cql_proxy_bind_address, "", "Address to bind the CQL proxy to"); -DEFINE_int32(cql_proxy_webserver_port, 0, "Webserver port for CQL proxy"); + DEFINE_int64(tserver_tcmalloc_max_total_thread_cache_bytes, 256_MB, "Total number of bytes to " - "use for the thread cache for tcmalloc across all threads in the tserver."); + "use for the thread cache for tcmalloc across all threads in the tserver."); DEFINE_bool(start_pgsql_proxy, true, "Starts a PostgreSQL proxy along with the tablet server"); -DEFINE_string(pgsql_proxy_bind_address, "", "Address to bind the PostgreSQL proxy to"); -DEFINE_int32(pgsql_proxy_webserver_port, 0, "Webserver port for PostgreSQL proxy"); DECLARE_string(rpc_bind_addresses); DECLARE_bool(callhome_enabled); DECLARE_int32(webserver_port); DECLARE_int32(logbuflevel); +DECLARE_string(redis_proxy_bind_address); +DECLARE_int32(redis_proxy_webserver_port); + +DECLARE_string(cql_proxy_bind_address); +DECLARE_int32(cql_proxy_webserver_port); + +DECLARE_string(pgsql_proxy_bind_address); +DECLARE_int32(pgsql_proxy_webserver_port); + namespace yb { namespace tserver {