From commits-return-6751-archive-asf-public=cust-asf.ponee.io@kudu.apache.org Wed Nov 21 04:29:42 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 90996180675 for ; Wed, 21 Nov 2018 04:29:41 +0100 (CET) Received: (qmail 8161 invoked by uid 500); 21 Nov 2018 03:29:40 -0000 Mailing-List: contact commits-help@kudu.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kudu.apache.org Delivered-To: mailing list commits@kudu.apache.org Received: (qmail 8142 invoked by uid 99); 21 Nov 2018 03:29:40 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Nov 2018 03:29:40 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id CABA8E1341; Wed, 21 Nov 2018 03:29:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: alexey@apache.org To: commits@kudu.apache.org Date: Wed, 21 Nov 2018 03:29:41 -0000 Message-Id: <36a93cfbe9f84c7c8d63c717d35e5540@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [3/4] kudu git commit: [webui] Fancy table for /mem-trackers and sortable tables [webui] Fancy table for /mem-trackers and sortable tables This fancifies the table of trackers on /mem-trackers in the style of 6ae9ecbe2595090c78e7afd271aae9d04dd4d0b5. It also adds the ability to sort some tables by some numeric columns. Namely: - the /mem-trackers trackers table is sortable by current consumption and peak consumption - the /tablets page tablets tables are sortable by on-disk size - the /maintenance-manager "non-running op" table is sortable by RAM anchored, logs retained, and perf. I tested this change out manually, verifying that ascending and descending sort looked good. Unfortunately, the bootstrap table library doesn't seem to use a stable sort. Change-Id: Ibdf8e7bd82fe2b95e699b8bb238a9cf0e5a7e727 Reviewed-on: http://gerrit.cloudera.org:8080/11968 Reviewed-by: Adar Dembo Reviewed-by: Andrew Wong Tested-by: Kudu Jenkins Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/7437626f Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/7437626f Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/7437626f Branch: refs/heads/master Commit: 7437626f42b30811720d59e792bc905662efd2b3 Parents: b8595f8 Author: Will Berkeley Authored: Tue Nov 20 14:46:09 2018 -0800 Committer: Will Berkeley Committed: Wed Nov 21 01:31:15 2018 +0000 ---------------------------------------------------------------------- src/kudu/server/default_path_handlers.cc | 24 ++++++---- src/kudu/server/webserver.cc | 1 + www/kudu.js | 68 +++++++++++++++++++++++++++ www/maintenance-manager.mustache | 6 +-- www/tablets.mustache | 4 +- 5 files changed, 90 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/7437626f/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 7574def..390630c 100644 --- a/src/kudu/server/default_path_handlers.cc +++ b/src/kudu/server/default_path_handlers.cc @@ -28,9 +28,7 @@ #include #include -#include #include // IWYU pragma: keep -#include #include #include #include @@ -50,7 +48,6 @@ #include "kudu/util/array_view.h" #include "kudu/util/debug-util.h" #include "kudu/util/easy_json.h" -#include "kudu/util/faststring.h" #include "kudu/util/flag_tags.h" #include "kudu/util/flags.h" #include "kudu/util/jsonwriter.h" @@ -203,7 +200,7 @@ static void MemUsageHandler(const Webserver::WebRequest& req, #endif } -// Registered to handle "/mem-trackers", and prints out to handle memory tracker information. +// Registered to handle "/mem-trackers", and prints out memory tracker information. static void MemTrackersHandler(const Webserver::WebRequest& /*req*/, Webserver::PrerenderedWebResponse* resp) { std::ostringstream* output = resp->output; @@ -231,9 +228,20 @@ static void MemTrackersHandler(const Webserver::WebRequest& /*req*/, #endif *output << "

Memory usage by subsystem

\n"; - *output << "\n"; - *output << " " - "\n"; + *output << "
IdParentLimitCurrent ConsumptionPeak consumption
\n"; + *output << "" + "" + "" + "" + "" + ""; *output << "\n"; vector > trackers; @@ -244,7 +252,7 @@ static void MemTrackersHandler(const Webserver::WebRequest& /*req*/, HumanReadableNumBytes::ToString(tracker->limit()); string current_consumption_str = HumanReadableNumBytes::ToString(tracker->consumption()); string peak_consumption_str = HumanReadableNumBytes::ToString(tracker->peak_consumption()); - (*output) << Substitute(" " // id, parent, limit + (*output) << Substitute("" // id, parent, limit "\n", // current, peak tracker->id(), parent, limit_str, current_consumption_str, peak_consumption_str); http://git-wip-us.apache.org/repos/asf/kudu/blob/7437626f/src/kudu/server/webserver.cc ---------------------------------------------------------------------- diff --git a/src/kudu/server/webserver.cc b/src/kudu/server/webserver.cc index 0fc0aec..d0fde6b 100644 --- a/src/kudu/server/webserver.cc +++ b/src/kudu/server/webserver.cc @@ -566,6 +566,7 @@ static const char* const kMainTemplate = R"( + http://git-wip-us.apache.org/repos/asf/kudu/blob/7437626f/www/kudu.js ---------------------------------------------------------------------- diff --git a/www/kudu.js b/www/kudu.js new file mode 100644 index 0000000..0933ca2 --- /dev/null +++ b/www/kudu.js @@ -0,0 +1,68 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Converts a human-readable bytes value like '1.23B' or '985.32M' to a number +// of bytes. The suffix must be present: '1.23' is not valid but '1.23B' is. +// Returns -1 if there's some failure. +function toNumBytes(humanReadableBytes) { + len = humanReadableBytes.length; + if (len <= 1) { + return -1; + } + unit = humanReadableBytes[len - 1]; + val = parseFloat(humanReadableBytes.substring(0, len - 1)); + if (isNaN(val)) { + return -1; + } + // Fallthrough intended throughout. + switch (unit) { + case 'Y': val *= 1024.0; // Enough bytes to handle any double. + case 'Z': val *= 1024.0; + case 'E': val *= 1024.0; + case 'P': val *= 1024.0; + case 'T': val *= 1024.0; + case 'G': val *= 1024.0; + case 'M': val *= 1024.0; + case 'K': val *= 1024.0; + case 'B': break; + default: + return -1; + } + return val; +} + +// A comparison function for human-readable byte strings. +function bytesSorter(left, right) { + if (right.length == 0 && left.length == 0) { + return 0; + } + if (left.length == 0) { + return -1; + } + if (right.length == 0) { + return 1; + } + left_bytes = toNumBytes(left.trim()); + right_bytes = toNumBytes(right.trim()); + if (left_bytes < right_bytes) { + return -1; + } + if (left_bytes > right_bytes) { + return 1; + } + return 0; +} http://git-wip-us.apache.org/repos/asf/kudu/blob/7437626f/www/maintenance-manager.mustache ---------------------------------------------------------------------- diff --git a/www/maintenance-manager.mustache b/www/maintenance-manager.mustache index 269a7d2..81d5247 100644 --- a/www/maintenance-manager.mustache +++ b/www/maintenance-manager.mustache @@ -63,9 +63,9 @@ under the License. - - - + + + http://git-wip-us.apache.org/repos/asf/kudu/blob/7437626f/www/tablets.mustache ---------------------------------------------------------------------- diff --git a/www/tablets.mustache b/www/tablets.mustache index ea1f94a..7a3f904 100644 --- a/www/tablets.mustache +++ b/www/tablets.mustache @@ -39,7 +39,7 @@ There are no tablet replicas. - + @@ -83,7 +83,7 @@ There are no tablet replicas. - +
IdParentLimitCurrent ConsumptionPeak Consumption
$0$1$2
$0$1$2$3$4
Name RunnableRAM anchoredLogs retainedPerfRAM anchoredLogs retainedPerf
Tablet ID Partition StateOn-disk sizeOn-disk size RaftConfig
Tablet ID Partition StateOn-disk sizeOn-disk size Last status