[
https://issues.apache.org/jira/browse/DRILL-6224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16398521#comment-16398521
]
ASF GitHub Bot commented on DRILL-6224:
---------------------------------------
Github user arina-ielchiieva commented on a diff in the pull request:
https://github.com/apache/drill/pull/1160#discussion_r174444297
--- Diff: exec/java-exec/src/main/resources/rest/index.ftl ---
@@ -291,6 +300,46 @@
var url = protocol + "//" + host + requestPath;
return url;
}
+
+ //Iterates through all the nodes for update
+ function reloadMemory () {
+ for (i = 1; i <= size; i++) {
+ var address =
$("#row-"+i).find("#address").contents().get(0).nodeValue.trim();
+ updateMemory(address, i);
+ }
+ }
+
+ //Update memory
+ function updateMemory(drillbit,idx) {
+ var result = $.ajax({
+ type: 'GET',
+ url: "http://"+drillbit+":8047/status/metrics",
+ dataType: "json",
+ complete: function(data) {
+ var metrics = data.responseJSON['gauges'];
+ var usedHeap = metrics['heap.used'].value;
+ var maxHeap = metrics['heap.max'].value;
+ var usedDirect = metrics['drill.allocator.root.used'].value;
+ var peakDirect = metrics['drill.allocator.root.peak'].value;
+ var heapUsage = computeMemUsage(usedHeap,maxHeap);
+ var directUsage = computeMemUsage(usedDirect,peakDirect);
+ var heapElem =
document.getElementById("row-"+idx).getElementsByClassName("heap")[0];
+ heapElem.innerHTML = heapUsage;
+ var directElem =
document.getElementById("row-"+idx).getElementsByClassName("direct")[0];
+ directElem.innerHTML = directUsage;
+ }
+ });
+ }
+
+ //Compute Usage
+ function computeMemUsage(used, max) {
+ var percent = 0;
+ if ( max > 0)
+ var percent = Math.round((100 * used / max), 2);
+ var usage = Math.round((used / 1073741824), 2) + "GB (" +
Math.max(0, percent) + "%)";
--- End diff --
This logic repeats in several files, so can create js function in separate
file and import it.
> The metrics' page has gauges reset to near zero values and does not seem to
> update
> ----------------------------------------------------------------------------------
>
> Key: DRILL-6224
> URL: https://issues.apache.org/jira/browse/DRILL-6224
> Project: Apache Drill
> Issue Type: Bug
> Components: Web Server
> Affects Versions: 1.12.0
> Reporter: Kunal Khatua
> Priority: Major
>
> When viewing http://<hostname>:8047/metrics#gauges
> The gauges reset to near zero values and does not seem to update.
> Tracing the server calls made, I see the following:
> {code:json}
> {version: "3.0.0", gauges: {G1-Old-Generation.count: {value: 0},
> G1-Old-Generation.time: {value: 0},…},…}
> counters :
> {drill.connections.rpc.control.encrypted: {count: 0},…}
> gauges :
> {G1-Old-Generation.count: {value: 0}, G1-Old-Generation.time: {value: 0},…}
> histograms : {,…}
> meters : {}
> timers : {}
> version : "3.0.0"
> {code}
> This looks incorrect and would explain why the metrics appear to be
> incomplete.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)