IMPALA-3715: Include total usage of JVM memory Get jvm metrics by global handler ExecEnv and filter out items with "total"
Testing: Ran locally and looked at memz page Change-Id: Ib44c25eb5a5d70f10a6a120501eec2d50fad5ce9 Reviewed-on: http://gerrit.cloudera.org:8080/3625 Reviewed-by: Henry Robinson <[email protected]> Tested-by: Internal Jenkins Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/74410326 Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/74410326 Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/74410326 Branch: refs/heads/master Commit: 744103264546e5fd695c0d4661a804da247e86c4 Parents: f129dfd Author: kathy.sun <[email protected]> Authored: Tue Jul 12 14:53:36 2016 -0700 Committer: Taras Bobrovytsky <[email protected]> Committed: Thu Jul 14 19:04:45 2016 +0000 ---------------------------------------------------------------------- be/src/util/default-path-handlers.cc | 11 +++++++++++ www/memz.tmpl | 31 ++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/74410326/be/src/util/default-path-handlers.cc ---------------------------------------------------------------------- diff --git a/be/src/util/default-path-handlers.cc b/be/src/util/default-path-handlers.cc index 8954fcc..740077b 100644 --- a/be/src/util/default-path-handlers.cc +++ b/be/src/util/default-path-handlers.cc @@ -23,6 +23,7 @@ #include <gutil/strings/substitute.h> #include "common/logging.h" +#include "runtime/exec-env.h" #include "runtime/mem-tracker.h" #include "util/debug-util.h" #include "util/pprof-path-handlers.h" @@ -105,6 +106,16 @@ void MemUsageHandler(MemTracker* mem_tracker, const Webserver::ArgumentMap& args Value detailed(mem_tracker->LogUsage().c_str(), document->GetAllocator()); document->AddMember("detailed", detailed, document->GetAllocator()); + Value jvm(kObjectType); + ExecEnv::GetInstance()->metrics()->GetChildGroup("jvm")->ToJson(false, document, &jvm); + + Value total(kArrayType); + for(SizeType i = 0; i < jvm["metrics"].Size(); ++i){ + if (strstr(jvm["metrics"][i]["name"].GetString(), "total") != nullptr){ + total.PushBack(jvm["metrics"][i], document->GetAllocator()); + } + } + document->AddMember("jvm", total, document->GetAllocator()); } void impala::AddDefaultUrlCallbacks( http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/74410326/www/memz.tmpl ---------------------------------------------------------------------- diff --git a/www/memz.tmpl b/www/memz.tmpl index 5b4636f..5709a89 100644 --- a/www/memz.tmpl +++ b/www/memz.tmpl @@ -19,10 +19,39 @@ limitations under the License. Memory consumption / limit: <strong>{{consumption}}</strong> / <strong>{{mem_limit}}</strong> -<h3>tcmalloc</h2> +<h3>tcmalloc</h3> <pre>{{overview}}</pre> <h3>Breakdown</h3> <pre>{{detailed}}</pre> +<h3>JVM memory total usage</h3> + +<table class='table table-bordered table-hover'> + <tr> + <th>Name</th> + <th>Value</th> + <th>Description</th> + </tr> + {{#jvm}} + <tr> + <td><tt>{{name}}</tt></td> + {{! Is this a stats metric? }} + {{?mean}} + <td> + Last (of {{count}}): <strong>{{last}}</strong>. + Min: {{min}}, max: {{max}}, avg: {{mean}}</td> + {{/mean}} + {{^mean}} + <td> + {{human_readable}} + </td> + {{/mean}} + <td> + {{description}} + </td> + </tr> + {{/jvm}} +</table> + {{> www/common-footer.tmpl }}
