This is an automated email from the ASF dual-hosted git repository.

joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git


The following commit(s) were added to refs/heads/master by this push:
     new fae38aa77 IMPALA-13866: Add the timestamp in /jvm-threadz page
fae38aa77 is described below

commit fae38aa77d152f0dc8e16e81464ef2d6e701f106
Author: skatiyal <[email protected]>
AuthorDate: Sun May 11 11:27:43 2025 +0530

    IMPALA-13866: Add the timestamp in /jvm-threadz page
    
    Enhanced /jvm-threadz WebUI page to include a timestamp for every jstack 
capture,
    It will help comparing multiple jstacks captured via WebUI.
    
    Change-Id: Ic0cb95028e175328c94aa2ad9df1f841efcde948
    Reviewed-on: http://gerrit.cloudera.org:8080/22877
    Reviewed-by: Impala Public Jenkins <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 be/src/util/thread.cc             |  3 +++
 tests/webserver/test_web_pages.py | 11 +++++++++++
 www/jvm-threadz.tmpl              |  2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/be/src/util/thread.cc b/be/src/util/thread.cc
index d0e4a0e83..315f2f6b6 100644
--- a/be/src/util/thread.cc
+++ b/be/src/util/thread.cc
@@ -31,6 +31,7 @@
 #include "util/metrics.h"
 #include "util/webserver.h"
 #include "util/os-util.h"
+#include "util/time.h"
 
 #include "common/names.h"
 
@@ -440,6 +441,8 @@ void JvmThreadsUrlCallback(const Webserver::WebRequest& 
req, Document* doc) {
   overview.AddMember("thread_count", response.total_thread_count, 
doc->GetAllocator());
   overview.AddMember("daemon_count", response.daemon_thread_count, 
doc->GetAllocator());
   overview.AddMember("peak_count", response.peak_thread_count, 
doc->GetAllocator());
+  overview.AddMember("timestamp", ToStringFromUnixMillis(UnixMillis(),
+      TimePrecision::Millisecond), doc->GetAllocator());
   doc->AddMember("overview", overview, doc->GetAllocator());
 
   Value lst(kArrayType);
diff --git a/tests/webserver/test_web_pages.py 
b/tests/webserver/test_web_pages.py
index cd1c9eb5c..880341c67 100644
--- a/tests/webserver/test_web_pages.py
+++ b/tests/webserver/test_web_pages.py
@@ -64,6 +64,7 @@ class TestWebPage(ImpalaTestSuite):
   HEALTHZ_URL = "http://localhost:{0}/healthz";
   EVENT_PROCESSOR_URL = "http://localhost:{0}/events";
   HADOOP_VARZ_URL = "http://localhost:{0}/hadoop-varz";
+  JVM_THREADZ_URL = "http://localhost:{0}/jvm-threadz";
 
   # log4j changes do not apply to the statestore since it doesn't
   # have an embedded JVM. So we make two sets of ports to test the
@@ -127,6 +128,16 @@ class TestWebPage(ImpalaTestSuite):
       assert "effective_locale" in other_info
       assert "glibc_version" in other_info
 
+  def test_jvm_threadz(self):
+      """Tests if timestamp is available in jvm-threadz page"""
+      for port in self.TEST_PORTS_WITHOUT_SS:
+        response = requests.get(self.JVM_THREADZ_URL.format(port) + "?json")
+        assert response.status_code == requests.codes.ok
+        jvm_threadz_page = json.loads(response.text)
+        overview = jvm_threadz_page["overview"]
+        assert len(overview) == 4
+        assert "timestamp" in overview
+
   def test_memz(self):
     """Tests /memz at impalad / statestored / catalogd"""
 
diff --git a/www/jvm-threadz.tmpl b/www/jvm-threadz.tmpl
index d4bae84ce..bae69bb65 100644
--- a/www/jvm-threadz.tmpl
+++ b/www/jvm-threadz.tmpl
@@ -20,9 +20,9 @@ under the License.
 
 {{> www/threadz_tabs.tmpl }}
 
-<h3>JVM Threads</h3>
 
 {{#overview}}
+<h3>JVM Threads captured at {{timestamp}}</h3>
 <h3>Total: {{thread_count}}, Daemon: {{daemon_count}}, Peak: 
{{peak_count}}</h3>
 {{/overview}}
 

Reply via email to