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 <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
stiga-huang
2023-11-06 10:00:43 +08:00
committed by Impala Public Jenkins
parent 10e816942a
commit 79a971b282
3 changed files with 19 additions and 12 deletions

View File

@@ -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());

View File

@@ -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:

View File

@@ -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>