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 0219bd07c IMPALA-13986: Update JS scripts to align with linting rules
0219bd07c is described below
commit 0219bd07c8a67cd405a421a972547d32c17dabc7
Author: Surya Hebbar <[email protected]>
AuthorDate: Tue May 27 18:06:17 2025 +0530
IMPALA-13986: Update JS scripts to align with linting rules
For large JS scripts, code-analysis and linting rules were added
to standardize changes for the webUI scripts in IMPALA-13473.
This change corrects the scripts to align with these linting
and code-analysis rules.
Change-Id: I5c8851c3d2f4e95b7eebd61f379361818afca7ea
Reviewed-on: http://gerrit.cloudera.org:8080/22950
Tested-by: Impala Public Jenkins <[email protected]>
Reviewed-by: Riza Suminto <[email protected]>
---
.../js_tests/queries/profileParseWorker.test.js | 12 +-
.../js_tests/query_timeline/chart_commons.test.js | 265 +++++++++++----------
.../query_timeline/fragment_diagram.test.js | 16 +-
.../fragment_metrics_diagram.test.js | 30 +--
.../host_utilization_diagram.test.js | 42 ++--
www/scripts/common_util.js | 31 +--
www/scripts/queries/profileParseWorker.js | 6 +-
www/scripts/query_timeline/chart_commons.js | 6 +-
www/scripts/query_timeline/fragment_diagram.js | 215 +++++++++--------
.../query_timeline/fragment_metrics_diagram.js | 44 ++--
www/scripts/query_timeline/global_dom.js | 4 +-
.../query_timeline/host_utilization_diagram.js | 60 ++---
12 files changed, 371 insertions(+), 360 deletions(-)
diff --git a/tests/webui/js_tests/queries/profileParseWorker.test.js
b/tests/webui/js_tests/queries/profileParseWorker.test.js
index e2e6d4b0d..cb5747ec7 100644
--- a/tests/webui/js_tests/queries/profileParseWorker.test.js
+++ b/tests/webui/js_tests/queries/profileParseWorker.test.js
@@ -15,8 +15,8 @@
// specific language governing permissions and limitations
// under the License.
-import {describe, test, expect} from '@jest/globals';
-import {readFileSync} from 'node:fs';
+import {describe, test, expect} from "@jest/globals";
+import {readFileSync} from "node:fs";
// JEST does not support workers, so "profileParseWorker.js" cannot be tested
directly
describe("Test Compression Library", () => {
@@ -26,10 +26,10 @@ describe("Test Compression Library", () => {
const exampleJSONProfileText =
readFileSync("../../../testdata/impala-profiles/"
+
"impala_profile_log_tpcds_compute_stats_extended.expected.pretty.json",
{encoding : "utf-8"});
- import("pako.min.js").then((pako) => {
- pako = pako.default;
- expect(pako.inflate(pako.deflate(exampleJSONProfileText, {level : 3}),
{to : "string"}))
- .toBe(exampleJSONProfileText);
+ import("pako.min.js").then(pako_pack => {
+ const pako = pako_pack.default;
+ expect(pako.inflate(pako.deflate(exampleJSONProfileText, {level : 3}),
+ {to : "string"})).toBe(exampleJSONProfileText);
});
});
});
diff --git a/tests/webui/js_tests/query_timeline/chart_commons.test.js
b/tests/webui/js_tests/query_timeline/chart_commons.test.js
index 367fb8fff..72ef08056 100644
--- a/tests/webui/js_tests/query_timeline/chart_commons.test.js
+++ b/tests/webui/js_tests/query_timeline/chart_commons.test.js
@@ -15,10 +15,10 @@
// specific language governing permissions and limitations
// under the License.
-import {describe, test, expect} from '@jest/globals';
+import {describe, test, expect} from "@jest/globals";
import {exportedForTest, generateTimesamples, clearTimeseriesValues,
mapTimeseriesCounters, aggregateProfileTimeseries} from
- 'scripts/query_timeline/chart_commons.js';
+ "scripts/query_timeline/chart_commons.js";
describe("Test mapTimeseriesCounters", () => {
// Test whether the method correctly searches and maps indexes of counters
based
@@ -26,29 +26,29 @@ describe("Test mapTimeseriesCounters", () => {
test("Basic Test (Serial Order)", () => {
const parent_profile =
{
- "profile_name": "Per Node Profiles",
- "num_children": 3,
- "child_profiles": [
+ "profile_name" : "Per Node Profiles",
+ "num_children" : 3,
+ "child_profiles" : [
{
- "profile_name": "host-1:27000",
- "time_series_counters": [{
- "counter_name": "HostCpuIoWaitPercentage",
- "unit": "BASIS_POINTS",
- "num": 59,
- "period": 100,
- "data": "0,0,0,70,0,0,0,0,0,10"
+ "profile_name" : "host-1 :27000",
+ "time_series_counters" : [{
+ "counter_name" : "HostCpuIoWaitPercentage",
+ "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" : "HostCpuSysPercentage",
+ "unit" : "BASIS_POINTS",
+ "num" : 59,
+ "period" : 100,
+ "data" : "312,679,445,440,301,301,312,125,125,437"
}, {
- "counter_name": "HostCpuUserPercentage",
- "unit": "BASIS_POINTS",
- "num": 59,
- "period": 100,
- "data": "312,679,445,440,301,301,312,125,125,437"
+ "counter_name" : "HostCpuUserPercentage",
+ "unit" : "BASIS_POINTS",
+ "num" : 59,
+ "period" : 100,
+ "data" : "312,679,445,440,301,301,312,125,125,437"
}]
}
]
@@ -68,29 +68,29 @@ describe("Test mapTimeseriesCounters", () => {
test("Basic Test (Reverse Order)", () => {
const parent_profile =
{
- "profile_name": "Per Node Profiles",
- "num_children": 3,
- "child_profiles": [
+ "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"
+ "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" : "HostCpuSysPercentage",
+ "unit" : "BASIS_POINTS",
+ "num" : 59,
+ "period" : 100,
+ "data" : "312,679,445,440,301,301,312,125,125,437"
}, {
- "counter_name": "HostCpuIoWaitPercentage",
- "unit": "BASIS_POINTS",
- "num": 59,
- "period": 100,
- "data": "312,679,445,440,301,301,312,125,125,437"
+ "counter_name" : "HostCpuIoWaitPercentage",
+ "unit" : "BASIS_POINTS",
+ "num" : 59,
+ "period" : 100,
+ "data" : "312,679,445,440,301,301,312,125,125,437"
}]
}
]
@@ -110,29 +110,29 @@ describe("Test mapTimeseriesCounters", () => {
test("Edge Case (No such 'counter_name' within profile)", () => {
const parent_profile =
{
- "profile_name": "Per Node Profiles",
- "num_children": 3,
- "child_profiles": [
+ "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"
+ "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" : "HostCpuSysPercentage",
+ "unit" : "BASIS_POINTS",
+ "num" : 59,
+ "period" : 100,
+ "data" : "312,679,445,440,301,301,312,125,125,437"
}, {
- "counter_name": "HostCpuIoWaitPercentage",
- "unit": "BASIS_POINTS",
- "num": 59,
- "period": 100,
- "data": "312,679,445,440,301,301,312,125,125,437"
+ "counter_name" : "HostCpuIoWaitPercentage",
+ "unit" : "BASIS_POINTS",
+ "num" : 59,
+ "period" : 100,
+ "data" : "312,679,445,440,301,301,312,125,125,437"
}]
}
]
@@ -165,9 +165,9 @@ describe("Test accumulateTimeseriesValues", () => {
};
const values_array = [DATA_TYPE, 0, 60, 100, 40, 38, 49, 61, 27];
const time_series_counter = {
- period: 100,
- num: 2000,
- data: "30, 100, 40"
+ period : 100,
+ num : 2000,
+ data : "30, 100, 40"
};
expect(accumulateTimeseriesValues(values_array, time_series_counter,
max_samples))
@@ -192,9 +192,9 @@ describe("Test accumulateTimeseriesValues", () => {
};
const values_array = [DATA_TYPE, 0, 60, 100, 40, 38, 49, 61, 27];
const time_series_counter = {
- period: 200,
- num: 300,
- data: "30, 100, 40"
+ period : 200,
+ num : 300,
+ data : "30, 100, 40"
};
expect(accumulateTimeseriesValues(values_array, time_series_counter,
max_samples))
@@ -220,9 +220,9 @@ describe("Test accumulateTimeseriesValues", () => {
};
const values_array = [DATA_TYPE, 0, 60, 100, 40, 38, 49, 61, 27];
const time_series_counter = {
- period: 100,
- num: 300,
- data: "30, 100, 40"
+ period : 100,
+ num : 300,
+ data : "30, 100, 40"
};
expect(accumulateTimeseriesValues(values_array, time_series_counter,
max_samples))
@@ -247,9 +247,9 @@ describe("Test accumulateTimeseriesValues", () => {
};
const values_array = [DATA_TYPE, 0, 60, 100];
const time_series_counter = {
- period: 100,
- num: 300,
- data: "30, 100, 40"
+ period : 100,
+ num : 300,
+ data : "30, 100, 40"
};
expect(accumulateTimeseriesValues(values_array, time_series_counter,
max_samples))
@@ -346,7 +346,8 @@ describe("Test clearTimeseriesValues", () => {
expect(clearTimeseriesValues(values_array, max_samples)).toBe(undefined);
- expect(values_array).toEqual([DATA_TYPE, 0, null, null, null, null, null,
null, null]);
+ expect(values_array).toEqual([DATA_TYPE, 0, null, null, null, null, null,
null,
+ null]);
});
});
@@ -355,73 +356,73 @@ describe("Test aggregateProfileTimeseries", () => {
test("Basic Case", () => {
const parent_profile =
{
- "profile_name": "Per Node Profiles",
- "num_children": 3,
- "child_profiles": [
+ "profile_name" : "Per Node Profiles",
+ "num_children" : 3,
+ "child_profiles" : [
{
- "profile_name": "host-1:27000",
- "time_series_counters": [{
- "counter_name": "HostCpuIoWaitPercentage",
- "unit": "BASIS_POINTS",
- "num": 59,
- "period": 100,
- "data": "0,0,0,70,0,0,0,0,0,10"
+ "profile_name" : "host-1 :27000",
+ "time_series_counters" : [{
+ "counter_name" : "HostCpuIoWaitPercentage",
+ "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" : "HostCpuSysPercentage",
+ "unit" : "BASIS_POINTS",
+ "num" : 59,
+ "period" : 100,
+ "data" : "312,679,445,440,301,301,312,125,125,437"
}, {
- "counter_name": "HostCpuUserPercentage",
- "unit": "BASIS_POINTS",
- "num": 59,
- "period": 100,
- "data": "312,679,445,440,301,301,312,125,125,437"
+ "counter_name" : "HostCpuUserPercentage",
+ "unit" : "BASIS_POINTS",
+ "num" : 59,
+ "period" : 100,
+ "data" : "312,679,445,440,301,301,312,125,125,437"
}]
},
{
- "profile_name": "host-1:27001",
- "time_series_counters": [{
- "counter_name": "HostCpuIoWaitPercentage",
- "unit": "BASIS_POINTS",
- "num": 59,
- "period": 100,
- "data": "0,0,0,70,0,0,0,0,0,10"
+ "profile_name" : "host-1 :27001",
+ "time_series_counters" : [{
+ "counter_name" : "HostCpuIoWaitPercentage",
+ "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" : "HostCpuSysPercentage",
+ "unit" : "BASIS_POINTS",
+ "num" : 59,
+ "period" : 100,
+ "data" : "312,679,445,440,301,301,312,125,125,437"
}, {
- "counter_name": "HostCpuUserPercentage",
- "unit": "BASIS_POINTS",
- "num": 59,
- "period": 100,
- "data": "312,679,445,440,301,301,312,125,125,437"
+ "counter_name" : "HostCpuUserPercentage",
+ "unit" : "BASIS_POINTS",
+ "num" : 59,
+ "period" : 100,
+ "data" : "312,679,445,440,301,301,312,125,125,437"
}]
},
{
- "profile_name": "host-1:27001",
- "time_series_counters": [{
- "counter_name": "HostCpuIoWaitPercentage",
- "unit": "BASIS_POINTS",
- "num": 59,
- "period": 100,
- "data": "0,0,0,70,0,0,0,0,0,10"
+ "profile_name" : "host-1 :27001",
+ "time_series_counters" : [{
+ "counter_name" : "HostCpuIoWaitPercentage",
+ "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" : "HostCpuSysPercentage",
+ "unit" : "BASIS_POINTS",
+ "num" : 59,
+ "period" : 100,
+ "data" : "312,679,445,440,301,301,312,125,125,437"
}, {
- "counter_name": "HostCpuUserPercentage",
- "unit": "BASIS_POINTS",
- "num": 59,
- "period": 100,
- "data": "312,679,445,440,301,301,312,125,125,437"
+ "counter_name" : "HostCpuUserPercentage",
+ "unit" : "BASIS_POINTS",
+ "num" : 59,
+ "period" : 100,
+ "data" : "312,679,445,440,301,301,312,125,125,437"
}]
}
]
@@ -449,9 +450,9 @@ describe("Test aggregateProfileTimeseries", () => {
max_samples)).toBe(undefined);
expect(aggregate_array).toEqual([
- ['avg io wait', 0, 0, 0, 0, 210, 0, 0, 0, 0, 0, 30],
- ['avg sys', 0, 936, 2037, 1335,1320, 903, 903, 936, 375, 375, 1311],
- ['avg user', 0, 936, 2037, 1335, 1320, 903, 903, 936, 375, 375, 1311]
+ ["avg io wait", 0, 0, 0, 0, 210, 0, 0, 0, 0, 0, 30],
+ ["avg sys", 0, 936, 2037, 1335,1320, 903, 903, 936, 375, 375, 1311],
+ ["avg user", 0, 936, 2037, 1335, 1320, 903, 903, 936, 375, 375, 1311]
]);
expect(max_samples).toEqual({
diff --git a/tests/webui/js_tests/query_timeline/fragment_diagram.test.js
b/tests/webui/js_tests/query_timeline/fragment_diagram.test.js
index 35112a5fc..188e2de9a 100644
--- a/tests/webui/js_tests/query_timeline/fragment_diagram.test.js
+++ b/tests/webui/js_tests/query_timeline/fragment_diagram.test.js
@@ -15,19 +15,19 @@
// specific language governing permissions and limitations
// under the License.
-import {describe, test, expect} from '@jest/globals';
+import {describe, test, expect} from "@jest/globals";
import {exportedForTest} from "scripts/query_timeline/fragment_diagram.js";
describe("Test getSvg*", () => {
// Test whether getSvg* methods correctly set attributes and return expected
elements
const {getSvgRect, getSvgLine, getSvgText, getSvgTitle, getSvgGroup} =
exportedForTest;
- const stroke_fill_colors = { black : "#000000", dark_grey : "#505050",
- light_grey : "#F0F0F0", transperent : "rgba(0, 0, 0, 0)" };
+ const stroke_fill_colors = {black : "#000000", dark_grey : "#505050",
+ light_grey : "#F0F0F0", transperent : "rgba(0, 0, 0, 0)"};
test("Test getSvgRect", () => {
expect(getSvgRect(stroke_fill_colors.transperent, 0, 0, 100, 100, "2 2",
stroke_fill_colors.black).outerHTML).toBe(
- '<rect x="0" y="0" width="100" height="100"'
+ `<rect x="0" y="0" width="100" height="100"`
+ ` fill="${stroke_fill_colors.transperent}"`
+ ` stroke-width="0.5"`
+ ` stroke="${stroke_fill_colors.black}"`
@@ -36,17 +36,17 @@ describe("Test getSvg*", () => {
test("Test getSvgLine", () => {
expect(getSvgLine(stroke_fill_colors.black, 0, 0, 100, 100,
true).outerHTML).toBe(
- '<line x1="0" y1="0" x2="100" y2="100"'
+ `<line x1="0" y1="0" x2="100" y2="100"`
+ ` stroke="${stroke_fill_colors.black}"`
- + ' stroke-dasharray="2 2"></line>');
+ + ` stroke-dasharray="2 2"></line>`);
});
test("Test getSvgText", () => {
expect(getSvgText("Text", stroke_fill_colors.black, 0, 0, 15, true, 300)
.outerHTML).toBe(
- '<text x="0" y="0" style="font-size: 10px;" dominant-baseline="middle"
'
+ `<text x="0" y="0" style="font-size: 10px;" dominant-baseline="middle"
`
+ `text-anchor="middle" fill="${stroke_fill_colors.black}"
textLength="300" `
- + 'lengthAdjust="spacingAndGlyphs">Text</text>');
+ + `lengthAdjust="spacingAndGlyphs">Text</text>`);
});
test("Test getSvgTitle", () => {
diff --git
a/tests/webui/js_tests/query_timeline/fragment_metrics_diagram.test.js
b/tests/webui/js_tests/query_timeline/fragment_metrics_diagram.test.js
index abd312db4..8c1794eb8 100644
--- a/tests/webui/js_tests/query_timeline/fragment_metrics_diagram.test.js
+++ b/tests/webui/js_tests/query_timeline/fragment_metrics_diagram.test.js
@@ -24,23 +24,23 @@ describe("Test initializeFragmentMetrics", () => {
test("Basic Test", () => {
const parent_profile =
{
- "profile_name": "Coordinator Fragment F31",
- "num_children": 1,
- "child_profiles": [
+ "profile_name" : "Coordinator Fragment F31",
+ "num_children" : 1,
+ "child_profiles" : [
{
- "profile_name": "Instance fe45c9c56d1:efd1b2a70000
(host=host-1:27000)",
- "time_series_counters": [{
- "counter_name": "MemoryUsage",
- "unit": "BYTES",
- "num": 6,
- "period": 500,
- "data": "12288,12288,12288,12288,12288,12288"
+ "profile_name" : "Instance fe45c9c56d1:efd1b2a70000
(host=host-1:27000)",
+ "time_series_counters" : [{
+ "counter_name" : "MemoryUsage",
+ "unit" : "BYTES",
+ "num" : 6,
+ "period" : 500,
+ "data" : "12288,12288,12288,12288,12288,12288"
}, {
- "counter_name": "ThreadUsage",
- "unit": "UNIT",
- "num": 1,
- "period": 500,
- "data": "4"
+ "counter_name" : "ThreadUsage",
+ "unit" : "UNIT",
+ "num" : 1,
+ "period" : 500,
+ "data" : "4"
}]
}
]
diff --git
a/tests/webui/js_tests/query_timeline/host_utilization_diagram.test.js
b/tests/webui/js_tests/query_timeline/host_utilization_diagram.test.js
index 2f5249351..88781def1 100644
--- a/tests/webui/js_tests/query_timeline/host_utilization_diagram.test.js
+++ b/tests/webui/js_tests/query_timeline/host_utilization_diagram.test.js
@@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
-import {describe, test, expect} from '@jest/globals';
+import {describe, test, expect} from "@jest/globals";
import {exportedForTest} from
"scripts/query_timeline/host_utilization_diagram.js";
describe("Test initializeUtilizationMetrics", () => {
@@ -25,29 +25,29 @@ describe("Test initializeUtilizationMetrics", () => {
test("Basic Test", () => {
const parent_profile =
{
- "profile_name": "Per Node Profiles",
- "num_children": 3,
- "child_profiles": [
+ "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"
+ "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" : "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"
+ "counter_name" : "HostNetworkRx",
+ "unit" : "BASIS_POINTS",
+ "num" : 59,
+ "period" : 100,
+ "data" : "312,679,445,440,301,301,312,125,125,437"
}]
}
]
diff --git a/www/scripts/common_util.js b/www/scripts/common_util.js
index 50f625b13..0a06ef893 100644
--- a/www/scripts/common_util.js
+++ b/www/scripts/common_util.js
@@ -15,47 +15,49 @@
// specific language governing permissions and limitations
// under the License.
-function getReadableSize(value, precision = 2) {
- const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
+function getReadableSize(value_p, precision = 2) {
+ const units = ["B", "KB", "MB", "GB", "TB", "PB"];
let current_unit = 0;
+ let value = value_p;
while( value >= 1e3 ) {
value = value / 1e3;
++current_unit;
}
- return value.toFixed(precision) + ' ' + units[current_unit];
+ return value.toFixed(precision) + " " + units[current_unit];
}
function getReadableTimeNS(value) {
if (value >= 1000000000) {
- return getReadableTimeMS(value / 1000000)
+ return getReadableTimeMS(value / 1000000);
} else if (value >= 1000000) {
- return (value / 1000000).toFixed(3) + "ms"
+ return (value / 1000000).toFixed(3) + "ms";
} else if (value >= 1000) {
- return (value / 1000).toFixed(3) + "us"
+ return (value / 1000).toFixed(3) + "us";
} else {
- return value + "ns"
+ return value + "ns";
}
}
-function getReadableTimeMS(value) {
+function getReadableTimeMS(value_p) {
let hour = false;
let minute = false;
let second = false;
let re = "";
+ let value = value_p;
if (value >= 3600000) {
- re += (Math.floor(value / 3600000) + "h");
+ re += Math.floor(value / 3600000) + "h";
value = value % 3600000;
hour = true;
}
if (value >= 60000) {
- re += (Math.floor(value / 60000) + "m");
+ re += Math.floor(value / 60000) + "m";
value = value % 60000;
minute = true;
}
// if hour is true, the time is large enough and we should
// ignore the remaining time on second level
if (!hour && value >= 1000) {
- re += (Math.floor(value / 1000) + "s");
+ re += Math.floor(value / 1000) + "s";
value = value % 1000;
second = true;
}
@@ -65,7 +67,7 @@ function getReadableTimeMS(value) {
value = "0" + value;
}
}
- re += (value + "ms")
+ re += value + "ms";
}
return re;
}
@@ -77,7 +79,7 @@ function getReadableTimeMS(value) {
*/
function renderSize(data, type, row) {
// If display or filter data is requested, format the data
- if (type === 'display' || type === 'filter') {
+ if (type === "display" || type === "filter") {
return getReadableSize(data);
}
return data;
@@ -90,7 +92,7 @@ function renderSize(data, type, row) {
*/
function renderTime(data, type, row) {
// If display or filter data is requested, format the data
- if (type === 'display' || type === 'filter') {
+ if (type === "display" || type === "filter") {
return getReadableTimeNS(data);
}
return data;
@@ -106,4 +108,5 @@ function getQueryID() {
if (query_id) {
return query_id.substring(0, query_id.indexOf("&"));
}
+ return undefined;
}
\ No newline at end of file
diff --git a/www/scripts/queries/profileParseWorker.js
b/www/scripts/queries/profileParseWorker.js
index 38a848396..a6c7118d7 100644
--- a/www/scripts/queries/profileParseWorker.js
+++ b/www/scripts/queries/profileParseWorker.js
@@ -18,14 +18,14 @@
importScripts("../../pako.min.js");
importScripts("../common_util.js");
-self.onmessage = (e) => {
+self.onmessage = e => {
const query = {};
try {
const profile = JSON.parse(e.data).contents;
const val = profile.profile_name;
query.id = val.substring(val.indexOf("=") + 1, val.length - 1);
query.user = profile.child_profiles[0].info_strings
- .find(({key}) => key === "User").value;
+ .find(({key})=> key === "User").value;
query.default_db = profile.child_profiles[0].info_strings
.find(({key}) => key === "Default Db").value;
query.type = profile.child_profiles[0].info_strings
@@ -54,4 +54,4 @@ self.onmessage = (e) => {
query.error = err;
}
self.postMessage(query);
-}
\ No newline at end of file
+};
\ No newline at end of file
diff --git a/www/scripts/query_timeline/chart_commons.js
b/www/scripts/query_timeline/chart_commons.js
index c59b27594..e1c3d9bfb 100644
--- a/www/scripts/query_timeline/chart_commons.js
+++ b/www/scripts/query_timeline/chart_commons.js
@@ -46,7 +46,7 @@ export function generateTimesamples(timesamples_array,
max_samples, extend) {
const MAX_TRAVERSE_LEN = Math.min(max_samples.available,
timesamples_array.length
- ARRAY_VALUES_START_INDEX);
for (let k = 0; k <= MAX_TRAVERSE_LEN; ++k) {
- timesamples_array[k + 1] = (k * AVG_PERIOD);
+ timesamples_array[k + 1] = k * AVG_PERIOD;
}
if (maxts / 1e9 > timesamples_array[max_samples.available + 1]) {
// extend by one additional point or correct the final point
@@ -91,7 +91,7 @@ export function clearTimeseriesValues(values_array,
max_samples) {
export function aggregateProfileTimeseries(parent_profile, aggregate_array,
counters, max_samples) {
- parent_profile.child_profiles.forEach((time_series_profiles) => {
+ parent_profile.child_profiles.forEach(time_series_profiles => {
for (let i = 0; i < aggregate_array.length; ++i) {
accumulateTimeseriesValues(aggregate_array[i],
time_series_profiles.time_series_counters[counters[i][2]],
@@ -134,6 +134,6 @@ export function destroyChart(chart, chart_dom_obj) {
return null;
}
-if (typeof process !== "undefined" && process.env.NODE_ENV === 'test') {
+if (typeof process !== "undefined" && process.env.NODE_ENV === "test") {
exportedForTest = {accumulateTimeseriesValues};
}
diff --git a/www/scripts/query_timeline/fragment_diagram.js
b/www/scripts/query_timeline/fragment_diagram.js
index 7fb0f7157..ac172d932 100644
--- a/www/scripts/query_timeline/fragment_diagram.js
+++ b/www/scripts/query_timeline/fragment_diagram.js
@@ -23,7 +23,7 @@ import {host_utilization_chart, getUtilizationWrapperHeight}
from "./host_utilization_diagram.js";
import {fragment_metrics_chart, getFragmentMetricsWrapperHeight,
updateFragmentMetricsChartOnClick} from "./fragment_metrics_diagram.js";
-import {showTooltip, hideTooltip} from "./chart_commons.js"
+import {showTooltip, hideTooltip} from "./chart_commons.js";
import "./global_dom.js";
export let exportedForTest;
@@ -31,8 +31,8 @@ export let exportedForTest;
export let name_width;
export let page_additional_height;
-const stroke_fill_colors = { black : "#000000", dark_grey : "#505050",
- light_grey : "#F0F0F0", transperent : "rgba(0, 0, 0, 0)" };
+const stroke_fill_colors = {black : "#000000", dark_grey : "#505050",
+ light_grey : "#F0F0F0", transperent : "rgba(0, 0, 0, 0)"};
const ROW_HEIGHT = 15;
const INTEGER_PART_ESTIMATE = 4;
const CHAR_WIDTH = 6;
@@ -44,12 +44,12 @@ let decimals_multiplier = Math.pow(10, 2);
// #phases_header
const phases = [
- { color: "#C0C0FF", label: "Prepare" },
- { color: "#E0E0E0", label: "Open" },
- { color: "#FFFFC0", label: "Produce First Batch" },
- { color: "#C0FFFF", label: "Send First Batch" },
- { color: "#C0FFC0", label: "Process Remaining Batches" },
- { color: "#FFC0C0", label: "Close" }
+ {color : "#C0C0FF", label : "Prepare"},
+ {color : "#E0E0E0", label : "Open"},
+ {color : "#FFFFC0", label : "Produce First Batch"},
+ {color : "#C0FFFF", label : "Send First Batch"},
+ {color : "#C0FFC0", label : "Process Remaining Batches"},
+ {color : "#FFC0C0", label : "Close"}
];
// #fragment_diagram
@@ -158,7 +158,7 @@ function markMinMaxAvg(event) {
let part;
for (i = 0; i < event.ts_list.length; i++) {
ts = event.ts_list[i];
- k = ((ts - min) * BUCKET_SIZE / EVENT_SPAN_T) | 0;
+ k = (ts - min) * BUCKET_SIZE / EVENT_SPAN_T | 0;
if (k >= BUCKET_SIZE) k = BUCKET_SIZE - 1;
part = event.parts[k];
if (ts < part.min) part.min = ts;
@@ -183,7 +183,7 @@ function attachBucketedPhaseTooltip(rect, part) {
return rect;
}
-function DrawBars(svg, rownum, row_height, events, xoffset, px_per_ns) {
+function DrawBars(svg, rownum_l, row_height, events, xoffset, px_per_ns) {
// Structure of each 'events' element -
// {
// no_bar : < Boolean value is set, if event is not to be rendered >
@@ -199,10 +199,10 @@ function DrawBars(svg, rownum, row_height, events,
xoffset, px_per_ns) {
const BAR_HEIGHT = row_height - 2;
const LAST_E_INDEX = events.length - 1;
const LAST_TS_INDEX = events[LAST_E_INDEX].ts_list.length - 1;
- let plan_node = getSvgGroup();
+ const plan_node = getSvgGroup();
plan_node.classList.add("plan_node");
// coordinates start with (0,0) in the top-left corner
- let y = rownum * row_height; // the y-position for the current phase
rectangle
+ let y = rownum_l * row_height; // the y-position for the current phase
rectangle
const cp_y = y; // copy of y, used to bring y-position back to the
top(initial value)
let dx, dy; // dimensions of the current phase rectangle
let bucketed = false;
@@ -211,14 +211,13 @@ function DrawBars(svg, rownum, row_height, events,
xoffset, px_per_ns) {
events.map(markMinMaxAvg);
bucketed = true;
} else {
- events.map((ev) => {
+ events.map(ev => {
ev.ts_list.sort((a, b) => a - b);
});
}
- let i;
let color_idx = LAST_E_INDEX;
- for (i = 0; i <= LAST_E_INDEX; ++i) {
+ for (let i = 0; i <= LAST_E_INDEX; ++i) {
if (events[i].no_bar) --color_idx;
}
@@ -234,7 +233,7 @@ function DrawBars(svg, rownum, row_height, events, xoffset,
px_per_ns) {
for (j = 0; j < events[i].parts.length; j++) {
part = events[i].parts[j]; // mantain a reference for reuse
if (part.count > 0) {
- dy = (part.count / events[i].ts_list.length) * BAR_HEIGHT;
+ dy = part.count / events[i].ts_list.length * BAR_HEIGHT;
} else {
// skip to the next iteration, if the current bucket has no
timestamps
continue;
@@ -269,7 +268,7 @@ function DrawBars(svg, rownum, row_height, events, xoffset,
px_per_ns) {
}
}
- y = rownum * row_height;
+ y = rownum_l * row_height;
if (events[LAST_E_INDEX].no_bar === undefined) {
// Plan node's top and bottom outlines
let top_edge_ts, bottom_edge_ts;
@@ -294,7 +293,7 @@ async function renderPhases() {
clearDOMChildren(phases_header);
let color_idx = 0;
const PHASE_WIDTH = Math.ceil(chart_width / phases.length);
- phases.forEach((p) => {
+ phases.forEach(p => {
let x = name_width + Math.ceil(chart_width * color_idx / phases.length);
x = Math.min(x, diagram_width - PHASE_WIDTH);
@@ -302,8 +301,8 @@ async function renderPhases() {
ROW_HEIGHT));
phases_header.appendChild(getSvgRect(phases[color_idx++].color, x + 1, 1,
PHASE_WIDTH - 2, ROW_HEIGHT - 2));
- phases_header.appendChild(getSvgText(p.label, stroke_fill_colors.black, x
+ PHASE_WIDTH
- / 2, (ROW_HEIGHT + 4) / 2 , ROW_HEIGHT, true,
+ phases_header.appendChild(getSvgText(p.label, stroke_fill_colors.black,
+ x + PHASE_WIDTH / 2, (ROW_HEIGHT + 4) / 2 , ROW_HEIGHT, true,
Math.min(p.label.length * CHAR_WIDTH, PHASE_WIDTH / 1.5)));
});
}
@@ -320,20 +319,21 @@ async function renderFragmentDiagram() {
if (!fragment.printed) {
fragment.printed = true;
- let pending_fragments = [];
- let fevents = fragment.events;
+ const pending_fragments = [];
+ const fevents = fragment.events;
- let frag_name = fragment.name.replace("Coordinator ",
"").replace("Fragment ", "");
+ const frag_name = fragment.name.replace("Coordinator ",
"").replace("Fragment ",
+ "");
fragment_diagram.appendChild(getSvgText(frag_name, fragment.color, 1,
text_y,
ROW_HEIGHT, false));
// Fragment/sender timing row
- let fragment_svg_group = getSvgGroup();
+ const fragment_svg_group = getSvgGroup();
DrawBars(fragment_svg_group, rownum_l, ROW_HEIGHT, fevents, name_width,
PX_PER_NS);
for (let i = 0; i < fragment.nodes.length; ++i) {
- let node = fragment.nodes[i];
+ const node = fragment.nodes[i];
if (node.events !== undefined) {
// Plan node timing row
@@ -359,92 +359,92 @@ async function renderFragmentDiagram() {
pending_children--;
}
- let label_x = frag_name_width + CHAR_WIDTH * pending_children;
- let label_width = Math.min(CHAR_WIDTH * node.name.length,
- name_width - label_x - 2);
+ const LABEL_X = frag_name_width + CHAR_WIDTH * pending_children;
+ const LABEL_WIDTH = Math.min(CHAR_WIDTH * node.name.length,
+ name_width - LABEL_X - 2);
fragment_diagram.appendChild(getSvgText(node.name, fragment.color,
- label_x, text_y, ROW_HEIGHT, false));
+ LABEL_X, text_y, ROW_HEIGHT, false));
if (node.parent_node !== undefined) {
- let y = ROW_HEIGHT * node.parent_node.rendering.rownum;
+ const Y = ROW_HEIGHT * node.parent_node.rendering.rownum;
if (node.is_sender) {
- let x = name_width + Math.min.apply(null, fevents[3].ts_list) *
PX_PER_NS;
+ const X = name_width + Math.min.apply(null, fevents[3].ts_list) *
PX_PER_NS;
// Dotted horizontal connector to received rows
fragment_diagram.appendChild(getSvgLine(fragment.color, name_width,
- y + ROW_HEIGHT / 2 - 1, x, y + ROW_HEIGHT / 2 - 1, true));
+ Y + ROW_HEIGHT / 2 - 1, X, Y + ROW_HEIGHT / 2 - 1, true));
// Dotted rectangle for received rows
- let x2 = name_width + Math.max.apply(null, fevents[4].ts_list) *
PX_PER_NS;
+ const X2 = name_width + Math.max.apply(null, fevents[4].ts_list) *
PX_PER_NS;
fragment_diagram.appendChild(getSvgRect(stroke_fill_colors.transperent,
- x, y + 4, x2 - x, ROW_HEIGHT - 10, "2 2", fragment.color));
+ X, Y + 4, X2 - X, ROW_HEIGHT - 10, "2 2", fragment.color));
}
if (node.is_sender && node.parent_node.rendering.rownum !== rownum_l
- 1) {
// DAG edge on right side to distant sender
- let x = name_width - (pending_senders) * CHAR_WIDTH - CHAR_WIDTH /
2;
+ const X = name_width - pending_senders * CHAR_WIDTH - CHAR_WIDTH /
2;
fragment_diagram.appendChild(getSvgLine(fragment.color,
node.parent_node.rendering.label_end,
- y + ROW_HEIGHT / 2, x , y + ROW_HEIGHT / 2, false));
- fragment_diagram.appendChild(getSvgLine(fragment.color, x,
- y + ROW_HEIGHT / 2, x, text_y - ROW_HEIGHT / 2 + 3, false));
- fragment_diagram.appendChild(getSvgLine(fragment.color, x,
- text_y - ROW_HEIGHT / 2 + 3, label_x + label_width,
+ Y + ROW_HEIGHT / 2, X , Y + ROW_HEIGHT / 2, false));
+ fragment_diagram.appendChild(getSvgLine(fragment.color, X,
+ Y + ROW_HEIGHT / 2, X, text_y - ROW_HEIGHT / 2 + 3, false));
+ fragment_diagram.appendChild(getSvgLine(fragment.color, X,
+ text_y - ROW_HEIGHT / 2 + 3, LABEL_X + LABEL_WIDTH,
text_y - ROW_HEIGHT / 2 + 3, false));
} else {
// DAG edge from parent to immediate child
- let x = frag_name_width + (pending_children + 1) * CHAR_WIDTH -
+ const X = frag_name_width + (pending_children + 1) * CHAR_WIDTH -
CHAR_WIDTH / 2;
- fragment_diagram.appendChild(getSvgLine(fragment.color, x, y +
- ROW_HEIGHT - 3, x, text_y - ROW_HEIGHT + 6, false));
+ fragment_diagram.appendChild(getSvgLine(fragment.color, X, Y +
+ ROW_HEIGHT - 3, X, text_y - ROW_HEIGHT + 6, false));
}
}
- node.rendering = { rownum: rownum_l, label_end: label_x + label_width
};
+ node.rendering = {rownum : rownum_l, label_end : LABEL_X +
LABEL_WIDTH};
if (node.num_children) {
// Scan (leaf) node
- pending_children += (node.num_children - node.is_receiver);
+ pending_children += node.num_children - node.is_receiver;
}
text_y += ROW_HEIGHT;
rownum_l++;
if (node.is_receiver) {
if (plan_order.checked) {
- printFragment(fragments[node.sender_frag_index])
+ printFragment(fragments[node.sender_frag_index]);
} else {
pending_fragments.push(fragments[node.sender_frag_index]);
}
}
}
fragment_svg_group.id = fragment.name;
- fragment_svg_group.addEventListener('click',
updateFragmentMetricsChartOnClick);
+ fragment_svg_group.addEventListener("click",
updateFragmentMetricsChartOnClick);
fragment_diagram.appendChild(fragment_svg_group);
// Visit sender fragments in reverse order to avoid dag edges crossing
pending_fragments.reverse().forEach(printFragment);
}
});
- fragments.forEach((fragment) => {
+ fragments.forEach(fragment => {
fragment.printed = false;
});
}
async function renderTimeticks() {
clearDOMChildren(timeticks_footer);
- let sec_per_tic = maxts / ntics / 1e9;
- let px_per_tic = chart_width / ntics;
+ const SEC_PER_TIC = maxts / ntics / 1e9;
+ const PX_PER_TIC = chart_width / ntics;
let x = name_width;
- let y = 0;
- let text_y = ROW_HEIGHT - 4;
+ const y = 0;
+ const text_y = ROW_HEIGHT - 4;
let timetick_label;
for (let i = 1; i <= ntics; ++i) {
- timeticks_footer.appendChild(getSvgRect(stroke_fill_colors.black, x, y,
px_per_tic,
+ timeticks_footer.appendChild(getSvgRect(stroke_fill_colors.black, x, y,
PX_PER_TIC,
ROW_HEIGHT));
timeticks_footer.appendChild(getSvgRect(stroke_fill_colors.light_grey, x +
1,
- y + 1, px_per_tic - 2, ROW_HEIGHT - 2));
- timetick_label = (i * sec_per_tic).toFixed(decimals);
+ y + 1, PX_PER_TIC - 2, ROW_HEIGHT - 2));
+ timetick_label = (i * SEC_PER_TIC).toFixed(decimals);
timeticks_footer.appendChild(getSvgText(timetick_label,
stroke_fill_colors.black,
- x + px_per_tic - timetick_label.length * CHAR_WIDTH + 2, text_y,
ROW_HEIGHT,
+ x + PX_PER_TIC - timetick_label.length * CHAR_WIDTH + 2, text_y,
ROW_HEIGHT,
false));
- x += px_per_tic;
+ x += PX_PER_TIC;
}
}
@@ -456,12 +456,12 @@ export function collectFragmentEventsFromProfile() {
const receiver_nodes = [];
let color_idx = 0;
try {
- // First pass: compute sizes
+ // First pass : compute sizes
const execution_profile = profile.child_profiles[2];
const EXECUTION_PROFILE_NAME = execution_profile.profile_name.split("
").slice(0,2)
.join(" ");
console.assert(EXECUTION_PROFILE_NAME === "Execution Profile");
- execution_profile.child_profiles.forEach((fp) => {
+ execution_profile.child_profiles.forEach(fp => {
if (fp.child_profiles !== undefined &&
fp.child_profiles[0].event_sequences !== undefined) {
@@ -478,7 +478,7 @@ export function collectFragmentEventsFromProfile() {
}
for (let instance = 1; instance < fp.child_profiles.length;
++instance) {
if (fp.child_profiles[instance].event_sequences !== undefined) {
- if (fp.child_profiles[instance].event_sequences[0].events.length ==
+ if (fp.child_profiles[instance].event_sequences[0].events.length
===
fevents.length) {
for (let en = 0; en < fevents.length; ++en) {
if (fevents[en].no_bar) continue;
@@ -505,11 +505,11 @@ export function collectFragmentEventsFromProfile() {
}
const fragment = {
- name: fp.profile_name,
- events: fevents,
- nodes: [ ],
- color: fragment_colors[color_idx]
- }
+ name : fp.profile_name,
+ events : fevents,
+ nodes : [ ],
+ color : fragment_colors[color_idx]
+ };
// Pick a new color for each plan fragment
color_idx = (color_idx + 1) % fragment_colors.length;
set_maxts(Math.max(maxts, fevents[fevents.length - 1].timestamp));
@@ -521,35 +521,35 @@ export function collectFragmentEventsFromProfile() {
if (pp.node_metadata === undefined) return;
node_path.push(index);
// pp.profile_name : "AGGREGATION_NODE (id=52)"
- let name_flds = pp.profile_name.split(/[()]/);
+ const name_flds = pp.profile_name.split(/[()]/);
// name_flds : ["AGGREGATION_NODE ", "id=52", ""]
- let node_type = name_flds[0].trim();
- // node_type: "AGGREGATION_NODE"
- let node_id = name_flds.length > 1 ?
+ const node_type = name_flds[0].trim();
+ // node_type : "AGGREGATION_NODE"
+ const NODE_ID = name_flds.length > 1 ?
parseInt(name_flds[1].split(/[=]/)[1]) : 0;
- // node_id: 52
+ // node_id : 52
node_name = pp.profile_name.replace("_NODE", "").replace("_", " ")
.replace("KrpcDataStreamSender", "SENDER")
.replace("Hash Join Builder", "JOIN BUILD")
.replace("join node_", "");
if (node_type.indexOf("SCAN_NODE") >= 0) {
- let table_name = pp.info_strings.find(({ key }) => key === "Table
Name")
+ const table_name = pp.info_strings.find(({key}) => key === "Table
Name")
.value.split(/[.]/);
node_name = node_name.replace("SCAN",
`SCAN [${table_name[table_name.length - 1]}]`);
}
const IS_RECEIVER = node_type === "EXCHANGE_NODE" ||
- (node_type === "HASH_JOIN_NODE" && pp.num_children < 3);
+ node_type === "HASH_JOIN_NODE" && pp.num_children < 3;
- const IS_SENDER = (node_type === "Hash Join Builder" ||
- node_type === "KrpcDataStreamSender");
+ const IS_SENDER = node_type === "Hash Join Builder" ||
+ node_type === "KrpcDataStreamSender";
let parent_node;
if (node_type === "PLAN_ROOT_SINK") {}
else if (pp.node_metadata.data_sink_id !== undefined) {
- parent_node = receiver_nodes[node_id]; // Exchange sender dst
+ parent_node = receiver_nodes[NODE_ID]; // Exchange sender dst
} else if (pp.node_metadata.join_build_id !== undefined) {
- parent_node = receiver_nodes[node_id]; // Join sender dst
+ parent_node = receiver_nodes[NODE_ID]; // Join sender dst
} else if (node_stack.length > 0) {
parent_node = node_stack[node_stack.length - 1];
} else if (all_nodes.length) {
@@ -573,25 +573,25 @@ export function collectFragmentEventsFromProfile() {
}
}
let node = {
- name: node_name,
- type: node_type,
- node_id: node_id,
- num_children: 0,
- child_index: 0,
- metadata: pp.node_metadata,
- parent_node: parent_node,
- events: node_events,
- path: node_path.slice(0),
- is_receiver: IS_RECEIVER,
- is_sender: IS_SENDER
- }
+ name : node_name,
+ type : node_type,
+ node_id : NODE_ID,
+ num_children : 0,
+ child_index : 0,
+ metadata : pp.node_metadata,
+ parent_node : parent_node,
+ events : node_events,
+ path : node_path.slice(0),
+ is_receiver : IS_RECEIVER,
+ is_sender : IS_SENDER
+ };
if (IS_SENDER) {
node.parent_node.sender_frag_index = fragments.length;
}
if (IS_RECEIVER) {
- receiver_nodes[node_id] = node;
+ receiver_nodes[NODE_ID] = node;
}
if (parent_node !== undefined) {
@@ -629,13 +629,16 @@ export function collectFragmentEventsFromProfile() {
if (cp.event_sequences !== undefined) {
if (node.events.length === cp.event_sequences[0].events.length) {
for (let en = 0; en < node.events.length; ++en) {
-
node.events[en].ts_list.push(cp.event_sequences[0].events[en].timestamp);
+ node.events[en].ts_list.push(
+ cp.event_sequences[0].events[en].timestamp);
}
} else {
let i = 0, en = 0;
- while(i < node.events.length && en <
cp.event_sequences[0].events.length) {
+ while(i < node.events.length && en < cp.event_sequences[0]
+ .events.length) {
if (node.events[i].label ===
cp.event_sequences[0].events[en].label) {
-
node.events[i].ts_list.push(cp.event_sequences[0].events[en].timestamp);
+ node.events[i]
+
.ts_list.push(cp.event_sequences[0].events[en].timestamp);
++en; ++i;
} else {
++i;
@@ -694,33 +697,35 @@ export function renderTimingDiagram() {
}
}
-fragment_diagram.addEventListener('mouseout', (e) => {
+fragment_diagram.addEventListener("mouseout", e => {
hideTooltip(host_utilization_chart);
hideTooltip(fragment_metrics_chart);
removeChildIfExists(fragment_diagram, timestamp_gridline);
});
-fragment_diagram.addEventListener('mousemove', (e) => {
- if (e.clientX + scrollable_screen.scrollLeft >= name_width && e.clientX +
scrollable_screen.scrollLeft <= name_width + chart_width){
+fragment_diagram.addEventListener("mousemove", e => {
+ if (e.clientX + scrollable_screen.scrollLeft >= name_width && e.clientX +
+ scrollable_screen.scrollLeft <= name_width + chart_width) {
removeChildIfExists(fragment_diagram, timestamp_gridline);
- timestamp_gridline = getSvgLine(stroke_fill_colors.black, e.clientX +
scrollable_screen.scrollLeft, 0, e.clientX + scrollable_screen.scrollLeft,
+ timestamp_gridline = getSvgLine(stroke_fill_colors.black, e.clientX +
+ scrollable_screen.scrollLeft, 0, e.clientX +
scrollable_screen.scrollLeft,
parseInt(fragment_diagram.style.height), false);
fragment_diagram.appendChild(timestamp_gridline);
- const GRIDLINE_TIME = ((maxts * (e.clientX + scrollable_screen.scrollLeft
- name_width) / chart_width) / 1e9);
+ const GRIDLINE_TIME = maxts * (e.clientX + scrollable_screen.scrollLeft
+ - name_width) / chart_width / 1e9;
showTooltip(host_utilization_chart, GRIDLINE_TIME);
showTooltip(fragment_metrics_chart, GRIDLINE_TIME);
fragment_diagram_title.textContent = GRIDLINE_TIME.toFixed(decimals) + "
s";
} else {
try {
host_utilization_chart.tooltip.hide();
- } catch (e) {
- }
+ } catch (except) {}
removeChildIfExists(fragment_diagram, timestamp_gridline);
fragment_diagram_title.textContent = "";
}
});
-fragment_diagram.addEventListener('wheel', (e) => {
+fragment_diagram.addEventListener("wheel", e => {
if (e.shiftKey) {
const WINDOW_DIAGRAM_WIDTH = window.innerWidth - BORDER_STROKE_WIDTH;
if (e.wheelDelta <= 0 && diagram_width <= WINDOW_DIAGRAM_WIDTH) return;
@@ -744,7 +749,7 @@ fragment_diagram.addEventListener('wheel', (e) => {
}
});
-timeticks_footer.addEventListener('wheel', (e) => {
+timeticks_footer.addEventListener("wheel", e => {
if (e.shiftKey) {
if (e.altKey) {
if (e.wheelDelta <= 0) {
@@ -752,7 +757,7 @@ timeticks_footer.addEventListener('wheel', (e) => {
set_decimals(decimals - 1);
decimals_multiplier /= 10;
} else {
- const RENDERING_CONSTRAINT = CHAR_WIDTH * ((decimals + 1) +
INTEGER_PART_ESTIMATE)
+ const RENDERING_CONSTRAINT = CHAR_WIDTH * (decimals + 1) +
INTEGER_PART_ESTIMATE
>= chart_width / ntics;
if (RENDERING_CONSTRAINT) return;
set_decimals(decimals + 1);
@@ -771,8 +776,8 @@ timeticks_footer.addEventListener('wheel', (e) => {
}
});
-plan_order.addEventListener('click', renderFragmentDiagram);
+plan_order.addEventListener("click", renderFragmentDiagram);
-if (typeof process !== "undefined" && process.env.NODE_ENV === 'test') {
+if (typeof process !== "undefined" && process.env.NODE_ENV === "test") {
exportedForTest = {getSvgRect, getSvgLine, getSvgText, getSvgTitle,
getSvgGroup};
}
diff --git a/www/scripts/query_timeline/fragment_metrics_diagram.js
b/www/scripts/query_timeline/fragment_metrics_diagram.js
index 9751db426..00789cda3 100644
--- a/www/scripts/query_timeline/fragment_metrics_diagram.js
+++ b/www/scripts/query_timeline/fragment_metrics_diagram.js
@@ -16,7 +16,7 @@
// under the License.
import {name_width, page_additional_height, setTimingDiagramDimensions}
- from "./fragment_diagram.js"
+ from "./fragment_diagram.js";
import {profile, diagram_width, DIAGRAM_MIN_HEIGHT, MARGIN_CHART_END,
resizeVerticalAll,
decimals} from "./global_members.js";
import {aggregateProfileTimeseries, generateTimesamples, clearTimeseriesValues,
@@ -33,7 +33,7 @@ export let fragment_metrics_chart = null;
const fragment_id_selections = new Map();
const fragment_metrics_counters = [
["MemoryUsage", "memory usage", 0],
- ["ThreadUsage", "thread usage", 0]
+ ["ThreadUsage","thread usage", 0]
];
const max_samples_fragment_metrics = {
allocated : 1000,
@@ -76,19 +76,19 @@ function initializeFragmentMetricsChart() {
right : 0
},
tick : {
- format : (x) => x.toFixed(decimals)
+ format : x => x.toFixed(decimals)
}
},
y :
{
tick : {
- format : (y) => getReadableSize(y, 1)
+ format : y => getReadableSize(y, 1)
}
},
y2 :
{
tick : {
- format : (y2) => (y2 === Math.floor(y2) ? y2 : "")
+ format : y2 => y2 === Math.floor(y2) ? y2 : ""
},
show : true
}
@@ -97,7 +97,7 @@ function initializeFragmentMetricsChart() {
}, tooltip : {
format : {
value : (value, ratio, id, index) => {
- if (id.includes("memory usage")){
+ if (id.includes("memory usage")) {
return getReadableSize(value, decimals);
} else {
return value + " Thread(s)";
@@ -118,8 +118,8 @@ function initializeFragmentMetricsChart() {
function dragResizeBar(mousemove_e) {
if (mousemove_e.target.classList[0] === "c3-event-rect") return;
- const NEXT_HEIGHT = getFragmentMetricsHeight() +
(fragment_metrics_resize_bar.offsetTop -
- mousemove_e.clientY);
+ const NEXT_HEIGHT = getFragmentMetricsHeight() + (
+ fragment_metrics_resize_bar.offsetTop - mousemove_e.clientY);
if (NEXT_HEIGHT >= DIAGRAM_MIN_HEIGHT &&
window.innerHeight - NEXT_HEIGHT - DIAGRAM_CONTROLS_HEIGHT >=
page_additional_height + getUtilizationWrapperHeight() +
DIAGRAM_MIN_HEIGHT) {
@@ -132,13 +132,13 @@ function initializeFragmentMetrics(parent_profile,
counters, max_samples, timeax
// user, sys, io and sampled timeticks
max_samples.available = 0;
max_samples.period = 0;
- const fragment_metrics_aggregate = new Array(counters.length);
+ fragment_metrics_aggregate = new Array(counters.length);
for (let i = 0; i < counters.length; ++i) {
fragment_metrics_aggregate[i] = new Array(max_samples.allocated + 3)
.fill(null);
fragment_metrics_aggregate[i][1] = 0;
}
- const sampled_fragment_metrics_timeseries = new Array(max_samples.allocated
+ 3)
+ sampled_fragment_metrics_timeseries = new Array(max_samples.allocated + 3)
.fill(null);
sampled_fragment_metrics_timeseries[0] = timeaxis_name;
mapTimeseriesCounters(parent_profile.child_profiles[0].time_series_counters,
counters);
@@ -177,7 +177,7 @@ export function collectFragmentMetricsFromProfile() {
const profile_fragments = profile.child_profiles[2].child_profiles;
// for all the fragments selected in the execution profile
- profile_fragments.every((fragment_profile) => {
+ profile_fragments.every(fragment_profile => {
// initialize the collection arrays for subsequent collections
// arrays are overwritten without further re-allocation to reduce memory
usage
if(fragment_id_selections.has(fragment_profile.profile_name)) {
@@ -223,7 +223,7 @@ export function collectFragmentMetricsFromProfile() {
axes : axes_mappings
});
// clear utilization value and timestamp samples arrays
- fragment_metrics_aggregate.forEach((acc_usage) => {
+ fragment_metrics_aggregate.forEach(acc_usage => {
clearTimeseriesValues(acc_usage, max_samples_fragment_metrics);
});
}
@@ -255,7 +255,7 @@ export function
updateFragmentMetricsChartOnClick(click_event) {
const SELECTED_FRAGMENT_ID =
click_event.target.parentElement.parentElement.id;
fragment_id_selections.delete(SELECTED_FRAGMENT_ID);
if (fragment_metrics_chart !== null) {
- const DID_UNLOAD =
fragment_metrics_chart.internal.getTargets().every((target) => {
+ const DID_UNLOAD =
fragment_metrics_chart.internal.getTargets().every(target => {
if (target.id.includes(SELECTED_FRAGMENT_ID)) {
const unload_ids = new Array(fragment_metrics_counters.length);
for (let i = 0; i < fragment_metrics_counters.length; i++) {
@@ -293,22 +293,22 @@ export function closeFragmentMetricsChart() {
setTimingDiagramDimensions();
}
-fragment_metrics_resize_bar.addEventListener('mousedown',
+fragment_metrics_resize_bar.addEventListener("mousedown",
function dragResizeBarBegin(mousedown_e) {
- fragment_metrics_resize_bar.removeEventListener('mousedown',
dragResizeBarBegin);
- document.body.addEventListener('mousemove', dragResizeBar);
- document.body.addEventListener('mouseup', function dragResrizeBarEnd() {
- document.body.removeEventListener('mouseup', dragResrizeBarEnd);
- document.body.removeEventListener('mousemove', dragResizeBar);
- fragment_metrics_resize_bar.addEventListener('mousedown',
dragResizeBarBegin);
+ fragment_metrics_resize_bar.removeEventListener("mousedown",
dragResizeBarBegin);
+ document.body.addEventListener("mousemove", dragResizeBar);
+ document.body.addEventListener("mouseup", function dragResrizeBarEnd() {
+ document.body.removeEventListener("mouseup", dragResrizeBarEnd);
+ document.body.removeEventListener("mousemove", dragResizeBar);
+ fragment_metrics_resize_bar.addEventListener("mousedown",
dragResizeBarBegin);
});
});
-fragment_metrics_close_btn.addEventListener('click',
closeFragmentMetricsChart);
+fragment_metrics_close_btn.addEventListener("click",
closeFragmentMetricsChart);
fragment_metrics_close_btn.style.height = `${DIAGRAM_CONTROLS_HEIGHT}px`;
fragment_metrics_close_btn.style.fontSize = `${DIAGRAM_CONTROLS_HEIGHT / 2}px`;
-if (typeof process !== "undefined" && process.env.NODE_ENV === 'test') {
+if (typeof process !== "undefined" && process.env.NODE_ENV === "test") {
exportedForTest = {initializeFragmentMetrics};
}
diff --git a/www/scripts/query_timeline/global_dom.js
b/www/scripts/query_timeline/global_dom.js
index 2f3b065c4..6db8fd954 100644
--- a/www/scripts/query_timeline/global_dom.js
+++ b/www/scripts/query_timeline/global_dom.js
@@ -15,9 +15,9 @@
// specific language governing permissions and limitations
// under the License.
-if (typeof process !== "undefined" && process.env.NODE_ENV === 'test' &&
+if (typeof process !== "undefined" && process.env.NODE_ENV === "test" &&
document.body.innerHTML === "") {
- const fs = await import('fs');
+ const fs = await import("fs");
document.body.innerHTML =
fs.readFileSync(`${process.env.IMPALA_HOME}/www/query_timeline.tmpl`, "utf-8")
.replace(/{{(.*?)}}/g, "")
.replace(/<script\b[^>]*>(.*?)<\/script>/gs, "")
diff --git a/www/scripts/query_timeline/host_utilization_diagram.js
b/www/scripts/query_timeline/host_utilization_diagram.js
index bf210490b..c78be14ff 100644
--- a/www/scripts/query_timeline/host_utilization_diagram.js
+++ b/www/scripts/query_timeline/host_utilization_diagram.js
@@ -60,7 +60,8 @@ const max_samples_utilization = {
let host_utilization_resize_factor = 0.2;
const host_utilization_close_btn =
document.getElementById("host_utilization_close_btn");
-const host_utilization_resize_bar =
document.getElementById("host_utilization_resize_bar");
+const host_utilization_resize_bar = document.getElementById(
+ "host_utilization_resize_bar");
function initializeUtilizationChart() {
const axis_mappings = {};
@@ -71,7 +72,7 @@ function initializeUtilizationChart() {
axis_mappings[read_write_metrics_counters[i][1]] = "y2";
}
const cpu_utilization_counter_group = new
Array(cpu_utilization_counters.length);
- for (let i = 0; i < cpu_utilization_counters.length; i++){
+ for (let i = 0; i < cpu_utilization_counters.length; i++) {
cpu_utilization_counter_group[i] = cpu_utilization_counters[i][1];
}
host_utilization_diagram.style = null;
@@ -79,7 +80,7 @@ function initializeUtilizationChart() {
bindto : "#host_utilization_diagram",
data : {
columns : [[UTILIZATION_TIMEAXIS_NAME, 0]],
- axes: axis_mappings,
+ axes : axis_mappings,
type : "area",
groups : [ cpu_utilization_counter_group ],
order : "asc",
@@ -98,19 +99,19 @@ function initializeUtilizationChart() {
right : 0
},
tick : {
- format : (x) => x.toFixed(decimals)
+ format : x => x.toFixed(decimals)
}
},
y :
{
tick : {
- format : (y) => y + '%'
+ format : y => y + "%"
}
},
y2 :
{
tick : {
- format : (y2) => `${getReadableSize(y2, 1)}/s`
+ format : y2 => `${getReadableSize(y2, 1)}/s`
},
show : true
}
@@ -119,8 +120,8 @@ function initializeUtilizationChart() {
}, tooltip : {
format : {
value : (value, ratio, id, index) => {
- if (cpu_utilization_counter_group.includes(id)){
- return value.toFixed(decimals) + '%';
+ if (cpu_utilization_counter_group.includes(id)) {
+ return value.toFixed(decimals) + "%";
} else {
return `${getReadableSize(value, decimals)}/s`;
}
@@ -155,7 +156,7 @@ function initializeUtilizationMetrics(parent_profile,
counters_y1, counters_y2,
max_samples, timeaxis_name) {
console.assert(parent_profile.profile_name === "Per Node Profiles");
// user, sys, io and sampled timeticks
- const cpu_nodes_usage_aggregate = new Array(counters_y1.length);
+ cpu_nodes_usage_aggregate = new Array(counters_y1.length);
max_samples.available = 0;
max_samples.period = 0;
for (let i = 0; i < counters_y1.length; ++i) {
@@ -164,18 +165,20 @@ function initializeUtilizationMetrics(parent_profile,
counters_y1, counters_y2,
cpu_nodes_usage_aggregate[i][0] = counters_y1[i][1];
cpu_nodes_usage_aggregate[i][1] = 0;
}
- const read_write_metrics_aggregate = new Array(counters_y2.length);
+ read_write_metrics_aggregate = new Array(counters_y2.length);
for (let i = 0; i < counters_y2.length; ++i) {
read_write_metrics_aggregate[i] = new Array(max_samples.allocated + 2)
.fill(null);
read_write_metrics_aggregate[i][0] = counters_y2[i][1];
read_write_metrics_aggregate[i][1] = 0;
}
- const sampled_utilization_timeseries = new Array(max_samples.allocated + 2)
+ sampled_utilization_timeseries = new Array(max_samples.allocated + 2)
.fill(null);
sampled_utilization_timeseries[0] = timeaxis_name;
- mapTimeseriesCounters(parent_profile.child_profiles[0].time_series_counters,
counters_y1);
- mapTimeseriesCounters(parent_profile.child_profiles[0].time_series_counters,
counters_y2);
+ mapTimeseriesCounters(parent_profile.child_profiles[0].time_series_counters,
+ counters_y1);
+ mapTimeseriesCounters(parent_profile.child_profiles[0].time_series_counters,
+ counters_y2);
return {cpu_nodes_usage_aggregate, read_write_metrics_aggregate,
sampled_utilization_timeseries};
}
@@ -216,7 +219,7 @@ export async function resizeUtilizationChart() {
export function collectUtilizationFromProfile() {
// do not collect metrics, in case host utilization is not visible
- if (!host_utilization_visible){
+ if (!host_utilization_visible) {
utilization_metrics_parse_successful = false;
return;
}
@@ -238,7 +241,7 @@ export function collectUtilizationFromProfile() {
const impala_server_profile = profile.child_profiles[1];
console.assert(impala_server_profile.profile_name === "ImpalaServer");
// Update the plot, only when number of samples in SummaryStatsCounter is
updated
- if (impala_server_profile.summary_stats_counters[0].num_of_samples ==
+ if (impala_server_profile.summary_stats_counters[0].num_of_samples ===
prev_utilization_num_samples) {
utilization_metrics_parse_successful = true;
return;
@@ -264,13 +267,13 @@ export function collectUtilizationFromProfile() {
return;
}
// average the aggregated metrics
- cpu_nodes_usage_aggregate.forEach((acc_usage) => {
+ cpu_nodes_usage_aggregate.forEach(acc_usage => {
for (let i = ARRAY_VALUES_START_INDEX; i <
max_samples_utilization.available
+ ARRAY_VALUES_START_INDEX; ++i) {
acc_usage[i] = acc_usage[i] / (100 *
per_node_profiles.child_profiles.length);
}
});
- read_write_metrics_aggregate.forEach((acc_usage) => {
+ read_write_metrics_aggregate.forEach(acc_usage => {
for (let i = ARRAY_VALUES_START_INDEX; i <
max_samples_utilization.available
+ ARRAY_VALUES_START_INDEX; ++i) {
acc_usage[i] = acc_usage[i] / per_node_profiles.child_profiles.length;
@@ -285,10 +288,10 @@ export function collectUtilizationFromProfile() {
sampled_utilization_timeseries]
});
// clear utilization value and timestamp samples arrays
- cpu_nodes_usage_aggregate.forEach((acc_usage) => {
+ cpu_nodes_usage_aggregate.forEach(acc_usage => {
clearTimeseriesValues(acc_usage, max_samples_utilization);
});
- read_write_metrics_aggregate.forEach((acc_usage) => {
+ read_write_metrics_aggregate.forEach(acc_usage => {
clearTimeseriesValues(acc_usage, max_samples_utilization);
});
prev_utilization_num_samples =
profile.child_profiles[1].summary_stats_counters[0]
@@ -308,19 +311,18 @@ export function destroyUtilizationChart() {
setTimingDiagramDimensions();
}
-host_utilization_resize_bar.addEventListener('mousedown',
+host_utilization_resize_bar.addEventListener("mousedown",
function dragResizeBarBegin(mousedown_e) {
- host_utilization_resize_bar.removeEventListener('mousedown',
dragResizeBarBegin);
- document.body.addEventListener('mousemove', dragResizeBar);
- document.body.addEventListener('mouseup', function dragResrizeBarEnd() {
- document.body.removeEventListener('mouseup', dragResrizeBarEnd);
- document.body.removeEventListener('mousemove', dragResizeBar);
- host_utilization_resize_bar.addEventListener('mousedown',
dragResizeBarBegin);
+ host_utilization_resize_bar.removeEventListener("mousedown",
dragResizeBarBegin);
+ document.body.addEventListener("mousemove", dragResizeBar);
+ document.body.addEventListener("mouseup", function dragResrizeBarEnd() {
+ document.body.removeEventListener("mouseup", dragResrizeBarEnd);
+ document.body.removeEventListener("mousemove", dragResizeBar);
+ host_utilization_resize_bar.addEventListener("mousedown",
dragResizeBarBegin);
});
});
-
-host_utilization_close_btn.addEventListener('click', (e) => {
+host_utilization_close_btn.addEventListener("click", e => {
host_utilization_visible = false;
destroyUtilizationChart();
});
@@ -328,6 +330,6 @@ host_utilization_close_btn.addEventListener('click', (e) =>
{
host_utilization_close_btn.style.height = `${DIAGRAM_CONTROLS_HEIGHT}px`;
host_utilization_close_btn.style.fontSize = `${DIAGRAM_CONTROLS_HEIGHT / 2}px`;
-if (typeof process !== "undefined" && process.env.NODE_ENV === 'test') {
+if (typeof process !== "undefined" && process.env.NODE_ENV === "test") {
exportedForTest = {initializeUtilizationMetrics};
}