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

michaelsmith 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 79a971b28 IMPALA-12535: Fix misleading metric keys for the threadz page
79a971b28 is described below

commit 79a971b282631eeedc0e822b7751679c41ba684a
Author: stiga-huang <[email protected]>
AuthorDate: Mon Nov 6 10:00:43 2023 +0800

    IMPALA-12535: Fix misleading metric keys for the threadz page
    
    The debug URL "/thread-group?all&json" returns metric keys as user_ns,
    kernel_ns, and iowait_ns. However, the unit is second instead of
    nanosecond. This fixes the misleading metric keys.
    
    Tests:
     - Add test in test_io_mgr_threads to verify the metric keys.
    
    Change-Id: I15a8cf0a318bc7122d1f5df29f18d8e467249ef7
    Reviewed-on: http://gerrit.cloudera.org:8080/20658
    Reviewed-by: Impala Public Jenkins <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 be/src/util/thread.cc             | 18 +++++++++---------
 tests/webserver/test_web_pages.py |  7 +++++++
 www/thread-group.tmpl             |  6 +++---
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/be/src/util/thread.cc b/be/src/util/thread.cc
index ee6847007..424c8d502 100644
--- a/be/src/util/thread.cc
+++ b/be/src/util/thread.cc
@@ -130,15 +130,15 @@ class ThreadMgr {
   //   "threads": [
   //       {
   //         "name": "work-loop(Disk: 0, Thread: 0)-17049",
-  //             "user_ns": 0,
-  //             "kernel_ns": 0,
-  //             "iowait_ns": 0
+  //             "user_s": 0,
+  //             "kernel_s": 0,
+  //             "iowait_s": 0
   //             },
   //       {
   //         "name": "work-loop(Disk: 1, Thread: 0)-17050",
-  //             "user_ns": 0,
-  //             "kernel_ns": 0,
-  //             "iowait_ns": 0
+  //             "user_s": 0,
+  //             "kernel_s": 0,
+  //             "iowait_s": 0
   //             }
   //        ]
   void ThreadGroupUrlCallback(const Webserver::WebRequest& req, Document* 
output);
@@ -280,11 +280,11 @@ void ThreadMgr::ThreadGroupUrlCallback(const 
Webserver::WebRequest& req,
         LOG_EVERY_N(INFO, 100) << "Could not get per-thread statistics: "
                                << status.GetDetail();
       } else {
-        val.AddMember("user_ns", static_cast<double>(stats.user_ns) / 1e9,
+        val.AddMember("user_s", static_cast<double>(stats.user_ns) / 1e9,
             document->GetAllocator());
-        val.AddMember("kernel_ns", static_cast<double>(stats.kernel_ns) / 1e9,
+        val.AddMember("kernel_s", static_cast<double>(stats.kernel_ns) / 1e9,
             document->GetAllocator());
-        val.AddMember("iowait_ns", static_cast<double>(stats.iowait_ns) / 1e9,
+        val.AddMember("iowait_s", static_cast<double>(stats.iowait_ns) / 1e9,
             document->GetAllocator());
       }
       lst.PushBack(val, document->GetAllocator());
diff --git a/tests/webserver/test_web_pages.py 
b/tests/webserver/test_web_pages.py
index 2924ff45a..74db29fb1 100644
--- a/tests/webserver/test_web_pages.py
+++ b/tests/webserver/test_web_pages.py
@@ -609,6 +609,13 @@ class TestWebPage(ImpalaTestSuite):
         self.THREAD_GROUP_URL + "?group=disk-io-mgr&json", 
ports_to_test=[25000])
     assert len(responses) == 1
     response_json = json.loads(responses[0].text)
+    # Verify metric keys for each thread
+    for t in response_json['threads']:
+      assert "name" in t
+      assert "id" in t
+      assert "user_s" in t
+      assert "kernel_s" in t
+      assert "iowait_s" in t
     thread_names = [t["name"] for t in response_json['threads']]
     expected_name_patterns = ["ADLS remote", "S3 remote", "HDFS remote"]
     for pattern in expected_name_patterns:
diff --git a/www/thread-group.tmpl b/www/thread-group.tmpl
index 3e169930c..2c32af61f 100644
--- a/www/thread-group.tmpl
+++ b/www/thread-group.tmpl
@@ -36,9 +36,9 @@ under the License.
     <tr>
       <td>{{name}}</td>
       <td>{{id}}</td>
-      <td>{{user_ns}}</td>
-      <td>{{kernel_ns}}</td>
-      <td>{{iowait_ns}}</td>
+      <td>{{user_s}}</td>
+      <td>{{kernel_s}}</td>
+      <td>{{iowait_s}}</td>
     </tr>
     {{/threads}}
   </tbody>

Reply via email to