From ca6d6b4a7786ecc3754532d85ed39da33684d5fc Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 29 Mar 2013 02:57:07 -0500 Subject: gras: added hooks to query instantaneous state --- python/gras/query/chart_factory.js | 5 +++++ python/gras/query/chart_total_io_counts.js | 31 ++++++++++++++++++------------ python/gras/query/main.js | 5 ----- 3 files changed, 24 insertions(+), 17 deletions(-) (limited to 'python') diff --git a/python/gras/query/chart_factory.js b/python/gras/query/chart_factory.js index 20715a6..ae23728 100644 --- a/python/gras/query/chart_factory.js +++ b/python/gras/query/chart_factory.js @@ -1,3 +1,8 @@ +/*********************************************************************** + * Some constants + **********************************************************************/ +var GRAS_CHARTS_STD_WIDTH = 250; + /*********************************************************************** * Chart registry for now chart types **********************************************************************/ diff --git a/python/gras/query/chart_total_io_counts.js b/python/gras/query/chart_total_io_counts.js index 2f9ced3..f959414 100644 --- a/python/gras/query/chart_total_io_counts.js +++ b/python/gras/query/chart_total_io_counts.js @@ -21,20 +21,29 @@ GrasChartTotalIoCounts.prototype.update = function(point) $('ul', this.div).remove(); //clear old lists this.div.append(ul); + function make_entry(strong, span) { - var init_time = parseInt(block_data.init_time); - var stats_time = parseInt(block_data.stats_time); - var tps = parseInt(block_data.tps); - var duration = (stats_time - init_time)/tps; var li = $('
'); - var strong = $('').text('Elapsed' + ': '); - var span = $('').text(duration.toFixed(2).toString() + ' secs'); + var strong = $('').text(strong + ": "); + var span = $('').text(span); li.append(strong); li.append(span); ul.append(li); } + //create total time elapsed entry + { + var init_time = block_data.init_time; + var stats_time = block_data.stats_time; + var tps = block_data.tps; + var duration = (stats_time - init_time)/tps; + make_entry('Elapsed', duration.toFixed(2).toString() + ' secs'); + } + var stuff = [ + ['Enque', 'items', 'items_enqueued'], + ['Enque', 'tags', 'tags_enqueued'], + ['Enque', 'msgs', 'msgs_enqueued'], ['Input', 'items', 'items_consumed'], ['Input', 'tags', 'tags_consumed'], ['Input', 'msgs', 'msgs_consumed'], @@ -50,12 +59,10 @@ GrasChartTotalIoCounts.prototype.update = function(point) var key = contents[2]; $.each(block_data[key], function(index, count) { - var li = $(''); - var strong = $('').text(dir + index.toString() + ': '); - var span = $('').text(count.toString() + ' ' + units); - li.append(strong); - li.append(span); - if (count > 0) ul.append(li); + if (count > 0) + { + make_entry(dir + index.toString(), count.toString() + ' ' + units); + } }); }); } diff --git a/python/gras/query/main.js b/python/gras/query/main.js index a12457e..a9c255b 100644 --- a/python/gras/query/main.js +++ b/python/gras/query/main.js @@ -1,8 +1,3 @@ -/*********************************************************************** - * Some constants - **********************************************************************/ -var GRAS_CHARTS_STD_WIDTH = 250; - /*********************************************************************** * Stats registry data structure **********************************************************************/ -- cgit