Files
impala/www/scripts/tests/query_timeline/host_utilization_diagram.test.js
Surya Hebbar fed578580b IMPALA-12364: Display memory, disk and network metrics in webUI's query timeline
This patch adds fragment-level metrics to the WebUI query timeline
display along with additional disk and network metrics.

The fragment's plan nodes are enlarged with an animated transition on
hovering over the fragment's row in query timeline's fragment diagram.

On clicking the plan nodes, total thread and memory usage of the parent
fragment are displayed, after accumulating memory and thread usage of
all child nodes. Thread usage is being shown on the additional Y-axis.

In this way, memory and thread usage of multiple fragments can be
compared alongside. A fragment's usage can be hidden by clicking
on any of the child plan nodes again.

These counters are available within the profile with following names.

- MemoryUsage
- ThreadUsage

Once a fragment's metrics are displayed, they are updated as they
are collected from the profile during a running query.

A grid-line is displayed along with a tooltip on hovering over the
fragment diagram, containing the instantaneous time at that position.
This grid-line also triggers tooltips and gridlines in other charts.

A warning is displayed on clicking a fragment with less number of samples
available.

RESOURCE_TRACE_RATIO query option must be set for providing periodic
metrics within the profile. This allows the following time series
counters to be displayed on the query timeline.

- HostDiskWriteThroughput
- HostDiskReadThroughput
- HostNetworkRx
- HostNetworkTx

The additional Y-axis within the utilization chart is used to represent
the average of these metrics.

The memory units in tooltips and ticks on co-ordinate axes are displayed
in human readable form such as KB, MB, GB and PB for convenience.

Both of the charts contain controls to close the chart. These charts
can also be resized until a maximum and minmum limit by dragging the
resize bar's handle.

Along with mouse wheel events, the diagrams can be horizontally
stretched by the help of buttons with horizontal zoom icons at the
top of the page. The zoom out button is disabled, when further zoom out
is not possible.

Timeticks are being autoscaled during fragment diagram's horizontal zoom.

In addition to the scrollbar, hovering on edges of the window allows
horizontal scrolling.

Test cases have been for the additional disk, network and fragment level
memory metrics parsing functions.

Change-Id: Ifd25e6f0bc9fbd664ec98936daff3f27182dfc7f
Reviewed-on: http://gerrit.cloudera.org:8080/20355
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2023-11-09 02:32:27 +00:00

88 lines
3.1 KiB
JavaScript

// 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.
import {describe, test, expect} from '@jest/globals';
import {exportedForTest} from "../../query_timeline/host_utilization_diagram.js";
describe("Test initializeUtilizationMetrics", () => {
// Test whether aggregate arrays and time sample arrays are correctly allocated
// based on counters and max_samples
var {initializeUtilizationMetrics} = exportedForTest;
test("Basic Test", () => {
var parent_profile =
{
"profile_name": "Per Node Profiles",
"num_children": 3,
"child_profiles": [
{
"profile_name": "host-1:27000",
"time_series_counters": [{
"counter_name": "HostCpuUserPercentage",
"unit": "BASIS_POINTS",
"num": 59,
"period": 100,
"data": "0,0,0,70,0,0,0,0,0,10"
}, {
"counter_name": "HostCpuSysPercentage",
"unit": "BASIS_POINTS",
"num": 59,
"period": 100,
"data": "312,679,445,440,301,301,312,125,125,437"
}, {
"counter_name": "HostNetworkRx",
"unit": "BASIS_POINTS",
"num": 59,
"period": 100,
"data": "312,679,445,440,301,301,312,125,125,437"
}]
}
]
};
var max_samples = {
allocated : 3,
period : 0,
available : 0,
collected : 0
};
var counters_y1 = [
["HostCpuUserPercentage", "avg io wait", 0],
["HostCpuSysPercentage", "avg sys", 0]
];
var counters_y2 = [
["HostNetworkRx", "avg network rx", 0]
];
var timeaxis_name = "utilization timeticks";
var {cpu_nodes_usage_aggregate, read_write_metrics_aggregate,
sampled_utilization_timeseries} = initializeUtilizationMetrics(
parent_profile, counters_y1, counters_y2,
max_samples, timeaxis_name);
expect(cpu_nodes_usage_aggregate).toEqual([
[counters_y1[0][1], 0, null, null, null],
[counters_y1[1][1], 0, null, null, null]
]);
expect(read_write_metrics_aggregate).toEqual([
[counters_y2[0][1], 0, null, null, null]
]);
expect(sampled_utilization_timeseries).toEqual(
[timeaxis_name, null, null, null, null]
);
expect(counters_y1[0][2]).toBe(0);
expect(counters_y1[1][2]).toBe(1);
expect(counters_y2[0][2]).toBe(2);
});
});