You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Josh Byster (Jira)" <ji...@apache.org> on 2024/07/10 04:36:00 UTC

[jira] [Created] (ARTEMIS-4915) TotalMessagesAdded/Acknowledged metrics are inaccurate if queues deleted

Josh Byster created ARTEMIS-4915:
------------------------------------

             Summary: TotalMessagesAdded/Acknowledged metrics are inaccurate if queues deleted
                 Key: ARTEMIS-4915
                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4915
             Project: ActiveMQ Artemis
          Issue Type: Bug
          Components: JMX, management
            Reporter: Josh Byster


Currently, the total messages added/acknowledged fields are computed by summing up the counts on the individual queues, i.e.

{code:java}
   @Override
   public long getTotalMessagesAdded() {
      long total = 0;

      for (Binding binding : iterableOf(postOffice.getAllBindings())) {
         if (binding.getType() == BindingType.LOCAL_QUEUE) {
            total += ((LocalQueueBinding) binding).getQueue().getMessagesAdded();
         }
      }

      return total;
   }
{code}

This fails to give an accurate count if queues are being created or deleted (for example, as consumers disconnect or reconnect).
This can easily be demonstrated by sending messages and then disconnecting all consumers (with queue auto-deletion) and seeing the "messages added" count drop to 0.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@activemq.apache.org
For additional commands, e-mail: issues-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact