[AMQ-6518] - fix up aveMessageSize dest stat and test

This commit is contained in:
gtully 2016-11-25 10:37:58 +00:00
parent 89c1a7b8ba
commit cfdff4edc5
2 changed files with 3 additions and 1 deletions

View File

@ -120,7 +120,7 @@ public class StatisticsBroker extends BrokerFilter {
statsMessage.setLong("inflightCount", stats.getInflight().getCount()); statsMessage.setLong("inflightCount", stats.getInflight().getCount());
statsMessage.setLong("messagesCached", stats.getMessagesCached().getCount()); statsMessage.setLong("messagesCached", stats.getMessagesCached().getCount());
// we are okay with the size without decimals so cast to long // we are okay with the size without decimals so cast to long
statsMessage.setLong("averageMessageSize", (long) stats.getMessageSize().getAveragePerSecond()); statsMessage.setLong("averageMessageSize", (long) stats.getMessageSize().getAverageSize());
statsMessage.setInt("memoryPercentUsage", dest.getMemoryUsage().getPercentUsage()); statsMessage.setInt("memoryPercentUsage", dest.getMemoryUsage().getPercentUsage());
statsMessage.setLong("memoryUsage", dest.getMemoryUsage().getUsage()); statsMessage.setLong("memoryUsage", dest.getMemoryUsage().getUsage());
statsMessage.setLong("memoryLimit", dest.getMemoryUsage().getLimit()); statsMessage.setLong("memoryLimit", dest.getMemoryUsage().getLimit());

View File

@ -117,6 +117,8 @@ public class BrokerStatisticsPluginTest extends TestCase{
assertTrue(reply.getMapNames().hasMoreElements()); assertTrue(reply.getMapNames().hasMoreElements());
assertTrue(reply.getJMSTimestamp() > 0); assertTrue(reply.getJMSTimestamp() > 0);
assertEquals(Message.DEFAULT_PRIORITY, reply.getJMSPriority()); assertEquals(Message.DEFAULT_PRIORITY, reply.getJMSPriority());
assertTrue(reply.getLong("averageMessageSize") > 0);
/* /*
for (Enumeration e = reply.getMapNames();e.hasMoreElements();) { for (Enumeration e = reply.getMapNames();e.hasMoreElements();) {
String name = e.nextElement().toString(); String name = e.nextElement().toString();