qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1497024 - in /qpid/trunk/qpid: cpp/src/qpid/broker/Deliverable.h cpp/src/qpid/broker/Exchange.cpp tests/src/py/qpid_tests/broker_0_10/stats.py
Date Wed, 26 Jun 2013 17:52:26 GMT
Author: gsim
Date: Wed Jun 26 17:52:25 2013
New Revision: 1497024

URL: http://svn.apache.org/r1497024
Log:
QPID-4950: ensure exchange stats are updated with correct content size for messages

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/Deliverable.h
    qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp
    qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/stats.py

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Deliverable.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Deliverable.h?rev=1497024&r1=1497023&r2=1497024&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Deliverable.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Deliverable.h Wed Jun 26 17:52:25 2013
@@ -38,7 +38,6 @@ namespace qpid {
 	    virtual Message& getMessage() = 0;
 
             virtual void deliverTo(const boost::shared_ptr<Queue>& queue) = 0;
-            virtual uint64_t contentSize() { return 0; }
             virtual ~Deliverable(){}
         };
     }

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp?rev=1497024&r1=1497023&r2=1497024&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp Wed Jun 26 17:52:25 2013
@@ -135,7 +135,7 @@ void Exchange::doRoute(Deliverable& msg,
     if (mgmtExchange != 0)
     {
         qmf::org::apache::qpid::broker::Exchange::PerThreadStats *eStats = mgmtExchange->getStatistics();
-        uint64_t contentSize = msg.contentSize();
+        uint64_t contentSize = msg.getMessage().getContentSize();
 
         eStats->msgReceives += 1;
         eStats->byteReceives += contentSize;

Modified: qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/stats.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/stats.py?rev=1497024&r1=1497023&r2=1497024&view=diff
==============================================================================
--- qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/stats.py (original)
+++ qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/stats.py Wed Jun 26 17:52:25 2013
@@ -63,6 +63,39 @@ class BrokerStatsTests(Base):
     def setup_access(self):
         return BrokerAgent(self.conn)
 
+    def test_exchange_stats(self):
+        agent = self.setup_access()
+        start_broker = agent.getBroker()
+
+        agent.addExchange("direct", "stats-test-exchange")
+        sess = self.setup_session()
+        tx_a = sess.sender("stats-test-exchange/a")
+        tx_b = sess.sender("stats-test-exchange/b")
+        rx_a = sess.receiver("stats-test-exchange/a")
+
+        exchange = agent.getExchange("stats-test-exchange")
+        self.failUnless(exchange, "expected a valid exchange object")
+        self.assertEqual(exchange.msgReceives, 0, "msgReceives")
+        self.assertEqual(exchange.msgDrops, 0, "msgDrops")
+        self.assertEqual(exchange.msgRoutes, 0, "msgRoutes")
+        self.assertEqual(exchange.byteReceives, 0, "byteReceives")
+        self.assertEqual(exchange.byteDrops, 0, "byteDrops")
+        self.assertEqual(exchange.byteRoutes, 0, "byteRoutes")
+
+        tx_a.send("0123456789")
+        tx_b.send("01234567890123456789")
+        tx_a.send("012345678901234567890123456789")
+        tx_b.send("0123456789012345678901234567890123456789")
+
+        exchange.update()
+        self.assertEqual(exchange.msgReceives, 4, "msgReceives")
+        self.assertEqual(exchange.msgDrops, 2, "msgDrops")
+        self.assertEqual(exchange.msgRoutes, 2, "msgRoutes")
+        self.assertEqual(exchange.byteReceives, 100, "byteReceives")
+        self.assertEqual(exchange.byteDrops, 60, "byteDrops")
+        self.assertEqual(exchange.byteRoutes, 40, "byteRoutes")
+
+        agent.delExchange("stats-test-exchange")
 
     def test_enqueues_dequeues(self):
         agent = self.setup_access()



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message