Show redelivery rate as a sub-thing of delivery rate.

This commit is contained in:
Simon MacMullen 2011-07-05 13:19:06 +01:00
parent 71372a479d
commit 0b0d3b6b62
5 changed files with 65 additions and 41 deletions

View File

@ -164,10 +164,11 @@ function is_stat_empty(obj, name) {
return false;
}
function is_col_empty(channels, name) {
for (var i = 0; i < channels.length; i++) {
var channel = channels[i];
if (!is_stat_empty(channel.message_stats, name)) {
function is_col_empty(objects, name, accessor) {
if (accessor == undefined) accessor = function(o) {return o.message_stats;};
for (var i = 0; i < objects.length; i++) {
var object = objects[i];
if (!is_stat_empty(accessor(object), name)) {
return false;
}
}

View File

@ -3,7 +3,7 @@
var col_return_unroutable = !is_col_empty(channels, 'return_unroutable');
var col_return_not_delivered = !is_col_empty(channels, 'return_not_delivered');
var col_redeliver = !is_col_empty(channels, 'redeliver');
var ratesWidth = 4 + (col_return_unroutable ? 1 : 0) + (col_return_not_delivered ? 1 : 0) + (col_redeliver ? 1 : 0);
var ratesWidth = 4 + (col_return_unroutable ? 1 : 0) + (col_return_not_delivered ? 1 : 0);
%>
<table class="list">
<thead>
@ -35,19 +35,21 @@
<th><%= fmt_sort('Unconfirmed', 'messages_unconfirmed') %></th>
<th><%= fmt_sort('Status', 'idle_since') %></th>
<% if (statistics_level == 'fine') { %>
<th><%= fmt_sort('publish', 'message_stats.publish_details.rate') %></th>
<th><%= fmt_sort('confirm', 'message_stats.confirm_details.rate') %></th>
<th><%= fmt_sort('deliver / get', 'message_stats.deliver_get_details.rate') %></th>
<th><%= fmt_sort('ack', 'message_stats.ack_details.rate') %></th>
<th><%= fmt_sort('publish', 'message_stats.publish_details.rate') %></th>
<th><%= fmt_sort('confirm', 'message_stats.confirm_details.rate') %></th>
<th>
<%= fmt_sort('deliver / get', 'message_stats.deliver_get_details.rate') %>
<% if (col_redeliver) { %>
<sub><%= fmt_sort('of which redelivered', 'message_stats.redeliver_details.rate') %></sub>
<% } %>
</th>
<th><%= fmt_sort('ack', 'message_stats.ack_details.rate') %></th>
<% if (col_return_unroutable) { %>
<th><%= fmt_sort('return (mandatory)', 'message_stats.return_unroutable_details.rate') %></th>
<% } %>
<% if (col_return_not_delivered) { %>
<th><%= fmt_sort('return (immediate)', 'message_stats.return_not_delivered_details.rate') %></th>
<% } %>
<% if (col_redeliver) { %>
<th><%= fmt_sort('redeliver', 'message_stats.redeliver_details.rate') %></th>
<% } %>
<% } %>
<% } else { %>
<!-- TODO make sortable after bug 23401 -->
@ -60,7 +62,12 @@
<% if (statistics_level == 'fine') { %>
<th>publish</th>
<th>confirm</th>
<th>deliver / get</th>
<th>
deliver / get
<% if (col_redeliver) { %>
<sub>of which redelivered</sub>
<% } %>
</th>
<th>ack</th>
<% if (col_return_unroutable) { %>
<th>return (mandatory)</th>
@ -68,9 +75,6 @@
<% if (col_return_not_delivered) { %>
<th>return (immediate)</th>
<% } %>
<% if (col_redeliver) { %>
<th>redeliver</th>
<% } %>
<% } %>
<% } %>
</tr>
@ -106,7 +110,12 @@
<% if (statistics_level == 'fine') { %>
<td class="r"><%= fmt_rate(channel.message_stats, 'publish') %></td>
<td class="r"><%= fmt_rate(channel.message_stats, 'confirm') %></td>
<td class="r"><%= fmt_rate(channel.message_stats, 'deliver_get') %></td>
<td class="r">
<%= fmt_rate(channel.message_stats, 'deliver_get') %>
<% if (col_redeliver) { %>
<sub><%= fmt_rate(channel.message_stats, 'redeliver') %></sub>
<% } %>
</td>
<td class="r"><%= fmt_rate(channel.message_stats, 'ack') %></td>
<% if (col_return_unroutable) { %>
<td class="r"><%= fmt_rate(channel.message_stats, 'return_unroutable') %></td>
@ -114,9 +123,6 @@
<% if (col_return_not_delivered) { %>
<td class="r"><%= fmt_rate(channel.message_stats, 'return_not_delivered') %></td>
<% } %>
<% if (col_redeliver) { %>
<td class="r"><%= fmt_rate(channel.message_stats, 'redeliver') %></td>
<% } %>
<% } %>
</tr>
<% } %>

View File

@ -1,5 +1,8 @@
<h3>Deliveries</h3>
<% if (object && object.length > 0) { %>
<%
var col_redeliver = !is_col_empty(object, 'redeliver', function(o) {return o.stats;});
%>
<table class="list list-with-total">
<tr>
<% if (mode == 'queue') { %>
@ -7,9 +10,13 @@
<% } else { %>
<th>Queue</th>
<% } %>
<th>deliver / get</th>
<th>
deliver / get
<% if (col_redeliver) { %>
<sub>of which redelivered</sub>
<% } %>
</th>
<th>ack</th>
<th>redeliver</th>
</tr>
<%
for (var i = 0; i < object.length; i++) {
@ -21,16 +28,24 @@
<% } else { %>
<td><%= link_queue(del.queue_details.vhost, del.queue_details.name) %></td>
<% } %>
<td class="r"><%= fmt_rate(del.stats, 'deliver_get') %></td>
<td class="r">
<%= fmt_rate(del.stats, 'deliver_get') %>
<% if (col_redeliver) { %>
<sub><%= fmt_rate(del.stats, 'redeliver') %></sub>
<% } %>
</td>
<td class="r"><%= fmt_rate(del.stats, 'ack') %></td>
<td class="r"><%= fmt_rate(del.stats, 'redeliver') %></td>
</tr>
<% } %>
<tr class="total">
<th>Total:</th>
<td><%= fmt_rate(totals, 'deliver_get', false, 'mini-highlight') %></td>
<td><%= fmt_rate(totals, 'ack', false, 'mini-highlight') %></td>
<td><%= fmt_rate(totals, 'redeliver', false, 'mini-highlight') %></td>
<td class="r">
<%= fmt_rate(totals, 'deliver_get', false, 'mini-highlight') %>
<% if (col_redeliver) { %>
<br/><%= fmt_rate(totals, 'redeliver', false) %>
<% } %>
</td>
<td class="r"><%= fmt_rate(totals, 'ack', false, 'mini-highlight') %></td>
</tr>
</table>
<% } else { %>

View File

@ -51,13 +51,13 @@
<% } %>
<tr class="total">
<th>Total:</th>
<td><%= fmt_rate(totals, 'publish', false, 'mini-highlight') %></td>
<td><%= fmt_rate(totals, 'confirm', false, 'mini-highlight') %></td>
<td class="r"><%= fmt_rate(totals, 'publish', false, 'mini-highlight') %></td>
<td class="r"><%= fmt_rate(totals, 'confirm', false, 'mini-highlight') %></td>
<% if (col_return_unroutable) { %>
<td><%= fmt_rate(totals, 'return_unroutable', false, 'mini-highlight') %></td>
<td class="r"><%= fmt_rate(totals, 'return_unroutable', false, 'mini-highlight') %></td>
<% } %>
<% if (col_return_not_delivered) { %>
<td><%= fmt_rate(totals, 'return_not_delivered', false, 'mini-highlight') %></td>
<td class="r"><%= fmt_rate(totals, 'return_not_delivered', false, 'mini-highlight') %></td>
<% } %>
</tr>
</table>

View File

@ -6,7 +6,6 @@
<% if (queues.length > 0) { %>
<%
var col_redeliver = !is_col_empty(queues, 'redeliver');
var ratesWidth = 3 + (col_redeliver ? 1 : 0);
%>
<table class="list">
<thead>
@ -14,7 +13,7 @@
<th colspan="<% if (nodes_interesting && vhosts_interesting) { %>6<% } else if (nodes_interesting || vhosts_interesting) { %>5<% } else { %>4<% } %>">Overview</th>
<th colspan="3">Messages</th>
<% if (statistics_level == 'fine') { %>
<th colspan="<%= ratesWidth %>">Message rates</th>
<th colspan="3">Message rates</th>
<% } %>
</tr>
<tr>
@ -32,12 +31,13 @@
<th><%= fmt_sort('Unacked', 'messages_unacknowledged') %></th>
<th><%= fmt_sort('Total', 'messages') %></th>
<% if (statistics_level == 'fine') { %>
<th><%= fmt_sort('incoming', 'message_stats.publish_details.rate') %></th>
<th><%= fmt_sort('deliver / get', 'message_stats.deliver_get_details.rate') %></th>
<th><%= fmt_sort('ack', 'message_stats.ack_details.rate') %></th>
<th><%= fmt_sort('incoming', 'message_stats.publish_details.rate') %></th>
<th><%= fmt_sort('deliver / get', 'message_stats.deliver_get_details.rate') %>
<% if (col_redeliver) { %>
<th><%= fmt_sort('redeliver', 'message_stats.redeliver_details.rate') %></th>
<sub><%= fmt_sort('of which redelivered', 'message_stats.redeliver_details.rate') %></sub>
<% } %>
</th>
<th><%= fmt_sort('ack', 'message_stats.ack_details.rate') %></th>
<% } %>
</tr>
</thead>
@ -68,11 +68,13 @@
<td class="r"><%= fmt_string(queue.messages) %></td>
<% if (statistics_level == 'fine') { %>
<td class="r"><%= fmt_rate(queue.message_stats, 'publish', false) %></td>
<td class="r"><%= fmt_rate(queue.message_stats, 'deliver_get', false) %></td>
<td class="r">
<%= fmt_rate(queue.message_stats, 'deliver_get', false) %>
<% if (col_redeliver) { %>
<sub><%= fmt_rate(queue.message_stats, 'redeliver', false) %></sub>
<% } %>
</td>
<td class="r"><%= fmt_rate(queue.message_stats, 'ack', false) %></td>
<% if (col_redeliver) { %>
<td class="r"><%= fmt_rate(queue.message_stats, 'redeliver', false) %></td>
<% } %>
<% } %>
</tr>
<% } %>