You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2020/04/30 17:49:12 UTC

[GitHub] [activemq-artemis] jbertram opened a new pull request #3109: ARTEMIS-2745 queue registering wrong metrics

jbertram opened a new pull request #3109:
URL: https://github.com/apache/activemq-artemis/pull/3109


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [activemq-artemis] clebertsuconic commented on a change in pull request #3109: ARTEMIS-2745 queue registering wrong metrics

Posted by GitBox <gi...@apache.org>.
clebertsuconic commented on a change in pull request #3109:
URL: https://github.com/apache/activemq-artemis/pull/3109#discussion_r418248801



##########
File path: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MetricsPluginTest.java
##########
@@ -198,6 +199,36 @@ public void testForBasicMetricsPresenceAndValue() throws Exception {
       checkMetric(metrics, "artemis.consumer.count", "queue", queueName, 0.0);
    }
 
+   @Test
+   public void testMessageCountWithPaging() throws Exception {
+      final String data = "Simple Text " + UUID.randomUUID().toString();
+      final String queueName = "simpleQueue";
+      final String addressName = "simpleAddress";
+
+      server.getAddressSettingsRepository().getMatch(addressName).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE).setMaxSizeBytes(1024 * 10).setPageSizeBytes(1024 * 5);
+
+      session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST));
+      ClientProducer producer = session.createProducer(addressName);
+      ClientMessage message = session.createMessage(true);
+      message.getBodyBuffer().writeString(data);
+      int messageCount = 0;
+      while (!server.getPagingManager().getPageStore(new SimpleString(addressName)).isPaging()) {
+         producer.send(message);
+         messageCount++;
+      }
+
+      assertEquals(messageCount, server.locateQueue(queueName).getMessageCount());
+      checkMetric(getMetrics(), "artemis.message.count", "queue", queueName, Double.valueOf(messageCount));
+
+      for (int i = 0; i < messageCount; i++) {
+         producer.send(message);
+      }
+      producer.close();
+
+      assertEquals(messageCount * 2, server.locateQueue(queueName).getMessageCount());

Review comment:
       This test fails... run it in loop.
   
   Wait.assertEquals please




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [activemq-artemis] jbertram commented on a change in pull request #3109: ARTEMIS-2745 queue registering wrong metrics

Posted by GitBox <gi...@apache.org>.
jbertram commented on a change in pull request #3109:
URL: https://github.com/apache/activemq-artemis/pull/3109#discussion_r418252356



##########
File path: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MetricsPluginTest.java
##########
@@ -198,6 +199,36 @@ public void testForBasicMetricsPresenceAndValue() throws Exception {
       checkMetric(metrics, "artemis.consumer.count", "queue", queueName, 0.0);
    }
 
+   @Test
+   public void testMessageCountWithPaging() throws Exception {
+      final String data = "Simple Text " + UUID.randomUUID().toString();
+      final String queueName = "simpleQueue";
+      final String addressName = "simpleAddress";
+
+      server.getAddressSettingsRepository().getMatch(addressName).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE).setMaxSizeBytes(1024 * 10).setPageSizeBytes(1024 * 5);
+
+      session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST));
+      ClientProducer producer = session.createProducer(addressName);
+      ClientMessage message = session.createMessage(true);
+      message.getBodyBuffer().writeString(data);
+      int messageCount = 0;
+      while (!server.getPagingManager().getPageStore(new SimpleString(addressName)).isPaging()) {
+         producer.send(message);
+         messageCount++;
+      }
+
+      assertEquals(messageCount, server.locateQueue(queueName).getMessageCount());
+      checkMetric(getMetrics(), "artemis.message.count", "queue", queueName, Double.valueOf(messageCount));
+
+      for (int i = 0; i < messageCount; i++) {
+         producer.send(message);
+      }
+      producer.close();
+
+      assertEquals(messageCount * 2, server.locateQueue(queueName).getMessageCount());

Review comment:
       Done. I ran the test 500 times with no failures.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [activemq-artemis] clebertsuconic commented on a change in pull request #3109: ARTEMIS-2745 queue registering wrong metrics

Posted by GitBox <gi...@apache.org>.
clebertsuconic commented on a change in pull request #3109:
URL: https://github.com/apache/activemq-artemis/pull/3109#discussion_r418249666



##########
File path: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MetricsPluginTest.java
##########
@@ -198,6 +199,36 @@ public void testForBasicMetricsPresenceAndValue() throws Exception {
       checkMetric(metrics, "artemis.consumer.count", "queue", queueName, 0.0);
    }
 
+   @Test
+   public void testMessageCountWithPaging() throws Exception {
+      final String data = "Simple Text " + UUID.randomUUID().toString();
+      final String queueName = "simpleQueue";
+      final String addressName = "simpleAddress";
+
+      server.getAddressSettingsRepository().getMatch(addressName).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE).setMaxSizeBytes(1024 * 10).setPageSizeBytes(1024 * 5);
+
+      session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST));
+      ClientProducer producer = session.createProducer(addressName);
+      ClientMessage message = session.createMessage(true);
+      message.getBodyBuffer().writeString(data);
+      int messageCount = 0;
+      while (!server.getPagingManager().getPageStore(new SimpleString(addressName)).isPaging()) {
+         producer.send(message);
+         messageCount++;
+      }
+
+      assertEquals(messageCount, server.locateQueue(queueName).getMessageCount());
+      checkMetric(getMetrics(), "artemis.message.count", "queue", queueName, Double.valueOf(messageCount));
+
+      for (int i = 0; i < messageCount; i++) {
+         producer.send(message);
+      }
+      producer.close();
+
+      assertEquals(messageCount * 2, server.locateQueue(queueName).getMessageCount());

Review comment:
       change this line to
   
   ```java
   Wait.assertEquals(messageCount, server.locateQueue(queueName)::getMessageCount);
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org