mirror of
https://github.com/apache/impala.git
synced 2026-01-31 00:00:20 -05:00
Add functions in CatalogUsageMonitor to monitor and report the catalog usage of the tables have the longest metadata loading time(Including maximum, median, 75th-ile, 95th-ile, 99th-ile time). Set default tables loading metrics capacity to 100. However, there might be a problem here because we only keep the capacity size to 100. For example, there might be case like a table has higher median loading time but has lower Maximum loading time which cannot make itself to the Top-100. For now, we will ignore case like that because we are aiming to find the tables with maximum longest loading time. Add the sorted table in Catalog server web-ui. The loading time is sorted by the maximum from load_duration metrics. But users can sort by other metrics in catalogd debug UI. Testing: - Add end-to-end test for webpage to verify the label and text exist in catalog debug page. Verify all fields are in JSON response - Launch Impala and activate some tables to see the table loading time shown successfully on the catalog debug UI page. Change-Id: I9305a867d7053cde9acc42dae6e47ee440f1a8bf Reviewed-on: http://gerrit.cloudera.org:8080/14600 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
94 lines
3.0 KiB
JavaScript
94 lines
3.0 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.
|
|
|
|
function getReadableSize(bytes) {
|
|
var units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'];
|
|
if (bytes <= 0) return bytes + ' B';
|
|
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
|
return (bytes / Math.pow(1024, i)).toFixed(2) + ' ' + units[i];
|
|
}
|
|
|
|
function getReadableTimeNS(value) {
|
|
if (value >= 1000000000) {
|
|
return getReadableTimeMS(value / 1000000)
|
|
} else if (value >= 1000000) {
|
|
return (value / 1000000).toFixed(3) + "ms"
|
|
} else if (value >= 1000) {
|
|
return (value / 1000).toFixed(3) + "us"
|
|
} else {
|
|
return value + "ns"
|
|
}
|
|
}
|
|
|
|
function getReadableTimeMS(value) {
|
|
var hour = false;
|
|
var minute = false;
|
|
var second = false;
|
|
var re = "";
|
|
if (value >= 3600000) {
|
|
re += (Math.floor(value / 3600000) + "h");
|
|
value = value % 3600000;
|
|
hour = true;
|
|
}
|
|
if (value >= 60000) {
|
|
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");
|
|
value = value % 1000;
|
|
second = true;
|
|
}
|
|
if (!hour && !minute) {
|
|
if (second) {
|
|
while (value.toString().length < 3) {
|
|
value = "0" + value;
|
|
}
|
|
}
|
|
re += (value + "ms")
|
|
}
|
|
return re;
|
|
}
|
|
|
|
/*
|
|
* Useful render function used in DataTable. It renders the size
|
|
* value into human readable format in 'display' and 'filter' modes,
|
|
* and uses the original value in 'sort' mode.
|
|
*/
|
|
function renderSize(data, type, row) {
|
|
// If display or filter data is requested, format the data
|
|
if (type === 'display' || type === 'filter') {
|
|
return getReadableSize(data);
|
|
}
|
|
return data;
|
|
}
|
|
|
|
/*
|
|
* Useful render function used in DataTable. It renders the time
|
|
* value (nano seconds) into human readable format in 'display'
|
|
* and 'filter' modes, and uses the original value in 'sort' mode.
|
|
*/
|
|
function renderTime(data, type, row) {
|
|
// If display or filter data is requested, format the data
|
|
if (type === 'display' || type === 'filter') {
|
|
return getReadableTimeNS(data);
|
|
}
|
|
return data;
|
|
} |