Skip to content

Commit

Permalink
DRILL-5921: Display counter metrics in table
Browse files Browse the repository at this point in the history
  • Loading branch information
prasadns14 authored and arina-ielchiieva committed Nov 13, 2017
1 parent 08f9955 commit b0a06be
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions exec/java-exec/src/main/resources/rest/metrics/metrics.ftl
Expand Up @@ -63,12 +63,6 @@
<strong>No histograms.</strong>
</div>
</div>
<h3 id="meters">Meters</h3>
<div id="metersVal">
<div class="alert alert-info">
<strong>No meters.</strong>
</div>
</div>
<h3 id="timers">Timers</h3>
<div id="timersVal">
<div class="alert alert-info">
Expand Down Expand Up @@ -98,6 +92,22 @@
});
};
function createCountersTable(counters) {
$("#countersVal").html(function() {
var table = "<table class=\"table table-striped\" id=\"countersTable\">";
table += "<tbody>";
$.each(counters, function(key, value) {
table += "<tr>";
table += "<td>" + key + "</td>";
table += "<td>" + value.count + "</td>";
table += "</tr>";
});
table += "</tbody>";
table += "</table>";
return table;
});
};
function updateBars(gauges) {
$.each(["heap","non-heap","total"], function(i, key) {
var used = gauges[key + ".used"].value;
Expand Down Expand Up @@ -138,21 +148,13 @@
});
};
function updateOthers(metrics) {
$.each(["counters", "meters"], function(i, key) {
if(! $.isEmptyObject(metrics[key])) {
$("#" + key + "Val").html(JSON.stringify(metrics[key], null, 2));
}
});
};
var update = function() {
$.get("/status/metrics", function(metrics) {
updateGauges(metrics.gauges);
updateBars(metrics.gauges);
if(! $.isEmptyObject(metrics.timers)) createTable(metrics.timers, "timers");
if(! $.isEmptyObject(metrics.histograms)) createTable(metrics.histograms, "histograms");
updateOthers(metrics);
if(! $.isEmptyObject(metrics.counters)) createCountersTable(metrics.counters);
});
};
Expand All @@ -161,4 +163,4 @@
</script>
</#macro>

<@page_html/>
<@page_html/>

0 comments on commit b0a06be

Please sign in to comment.