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

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

                Author: ASF GitHub Bot
            Created on: 29/Jun/22 19:29
            Start Date: 29/Jun/22 19:29
    Worklog Time Spent: 10m 
      Work Description: michaelpearce-gain commented on code in PR #4126:
URL: https://github.com/apache/activemq-artemis/pull/4126#discussion_r910325886


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java:
##########
@@ -1770,8 +1770,26 @@ public String listConsumersAsJSON() throws Exception {
 
             if (consumer instanceof ServerConsumer) {
                ServerConsumer serverConsumer = (ServerConsumer) consumer;
-
-               JsonObjectBuilder obj = 
JsonLoader.createObjectBuilder().add("consumerID", 
serverConsumer.getID()).add("connectionID", 
serverConsumer.getConnectionID().toString()).add("sessionID", 
serverConsumer.getSessionID()).add("browseOnly", 
serverConsumer.isBrowseOnly()).add("creationTime", 
serverConsumer.getCreationTime());
+               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();

Review Comment:
   If we want this for metrics would be safer to keep this count as a metric on 
the consumer adding the size and removing it from the metric as messages are 
added or ack'd this would also save on the above mentioned npe / concurrent 
issue 





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

    Worklog Id:     (was: 786179)
    Time Spent: 1h 20m  (was: 1h 10m)

> 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: 1h 20m
>  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