[ 
https://issues.apache.org/jira/browse/ARTEMIS-3875?focusedWorklogId=802439&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-802439
 ]

ASF GitHub Bot logged work on ARTEMIS-3875:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 22/Aug/22 11:35
            Start Date: 22/Aug/22 11:35
    Worklog Time Spent: 10m 
      Work Description: andytaylor commented on code in PR #4126:
URL: https://github.com/apache/activemq-artemis/pull/4126#discussion_r951330777


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java:
##########
@@ -2752,7 +2753,27 @@ public String listAllConsumersAsJSON() throws Exception {
    }
 
    private JsonObject toJSONObject(ServerConsumer consumer) throws Exception {
-      JsonObjectBuilder obj = 
JsonLoader.createObjectBuilder().add("consumerID", 
consumer.getID()).add("connectionID", 
consumer.getConnectionID().toString()).add("sessionID", 
consumer.getSessionID()).add("queueName", 
consumer.getQueue().getName().toString()).add("browseOnly", 
consumer.isBrowseOnly()).add("creationTime", 
consumer.getCreationTime()).add("deliveringCount", 
consumer.getDeliveringMessages().size());
+      List<MessageReference> deliveringMessages = 
consumer.getDeliveringMessages();
+      long deliveringMessageSize = 0;
+      for (int i = 0; i < deliveringMessages.size(); i++) {
+         MessageReference messageReference =  deliveringMessages.get(i);
+         deliveringMessageSize += 
messageReference.getMessage().getEncodeSize();
+      }
+      long currentTime = System.currentTimeMillis();
+      long lastDeliveredTimeElapsed = consumer.getLastDeliveredTime() == 0 ? 0 
: currentTime - consumer.getLastDeliveredTime();
+      long lastAckTimeElapsed = consumer.getLastAcknowledgedTime() == 0 ? 0 : 
currentTime - consumer.getLastAcknowledgedTime();
+      JsonObjectBuilder obj = JsonLoader.createObjectBuilder()
+            .add("consumerID", consumer.getID())
+            .add("connectionID", consumer.getConnectionID().toString())
+            .add("sessionID", consumer.getSessionID())
+            .add("queueName", consumer.getQueue().getName().toString())
+            .add("browseOnly", consumer.isBrowseOnly())
+            .add("creationTime", consumer.getCreationTime())
+            .add("deliveringCount", deliveringMessages.size())
+            .add("deliveringSize", deliveringMessageSize)
+            .add("messagesAcknowledged", consumer.getMessagesAcknowledged())
+            .add("lastDeliveredTimeElapsed", lastDeliveredTimeElapsed)
+            .add("lastAcknowledgedTimeElapsed", lastAckTimeElapsed);

Review Comment:
   they were on a single line but I have replaced anyway





Issue Time Tracking
-------------------

    Worklog Id:     (was: 802439)
    Time Spent: 2.5h  (was: 2h 20m)

> expose more consumer/producer metrics
> -------------------------------------
>
>                 Key: ARTEMIS-3875
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3875
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>            Reporter: Andy Taylor
>            Assignee: Andy Taylor
>            Priority: Major
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> adding the following metrics:
>  
> _Consumer_
> _Msgs Sent - current number of messages sent to consumer which are not yet 
> acknowledged._
> _Size Sent - combined size of unacknowledged messages sent to consumer._
> _Last Sent - approximate time elapsed since last message was sent by the 
> server to the consumer._
> _Last Akcd - approximate time elapsed since last time any message sent to the 
> consumer was acknowledged by consumer._
> _Total Sent - total number of messages sent to consumer since it was created._
> _Total Acked - total number of messages sent to the consumer and acknowledged 
> by consumer since it was created._
>  
> _Producer_
> _Total Msgs Sent - number of messages sent by the producer_
> _Total Size Sent - combined size of messages sent by the producer_



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

Reply via email to