[
https://issues.apache.org/jira/browse/AMQ-9548?focusedWorklogId=984854&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-984854
]
ASF GitHub Bot logged work on AMQ-9548:
---------------------------------------
Author: ASF GitHub Bot
Created on: 27/Sep/25 09:20
Start Date: 27/Sep/25 09:20
Worklog Time Spent: 10m
Work Description: kenliao94 commented on PR #1288:
URL: https://github.com/apache/activemq/pull/1288#issuecomment-3341439512
Actually thanks for the comment. I caught a bug. The TotalManaged counts
suppressed one as well. I,E `safeGetBroker().getTopicViews().size()` returns
suppressed ones as well
However, when I do more deep dive, It turns out that there is no map that
stores managed destinations. The getQueues() and getTopics() are doing the
filtering everytime it is called because of that. When a MBean is registered,
it internally invokes isAllowedToRegister to check if a given MBean can be
registered and register it if allowed. But instead of storing different maps
categorized by destination, it is a single map of all registered MBeans. Hence,
to get the total number of managed queue or topic, we need to iterate a list of
queue or topic and invoke isAllowedToRegister again every time (similar to how
onlyNonSuppressed work, it is not retrieving a cached value, but iterate over a
set and check everytime).
For now, I agree with your suggestion on exposing the APIs and what do that
suppose to mean. I changed the name of those metrics "NonSuppressed" ->
"Managed" and added the testcase to test for suppressed destination. The only
thing I rollback to, is that I need to first generate the array first and reads
the size, the inefficiency you initially pointed out.
```
@Override
public int getTotalManagedTopicsCount() {
return safeGetBroker().getTopicsNonSuppressed().length;
}
```
That said, I can follow up with another PR that changes the way how the
ManagementContext stores the registered destination, such that
getTotalManagedQueuesCount and getTotalManagedTopicsCount can be done by
reading a map size and it won't be a API / breaking change, so it can be done
in a patch version. WDYT? @mattrpav
Issue Time Tracking
-------------------
Worklog Id: (was: 984854)
Time Spent: 10h 40m (was: 10.5h)
> Add new broker mbean attributes to directly retrieve total number of queues
> and topics
> --------------------------------------------------------------------------------------
>
> Key: AMQ-9548
> URL: https://issues.apache.org/jira/browse/AMQ-9548
> Project: ActiveMQ Classic
> Issue Type: Improvement
> Components: JMX
> Affects Versions: 5.18.5, 6.1.2
> Reporter: Ken Liao
> Assignee: Ken Liao
> Priority: Major
> Fix For: 6.2.0
>
> Time Spent: 10h 40m
> Remaining Estimate: 0h
>
> Right now, to monitor the number of destination, the only way is to read the
> destinations MBean and get the total destination. However, this means reading
> all destination names into memory, if the user has 10K+ destination with long
> destination name, it will be a large amount of memory just to monitor the
> number of them.
> The proposal here is to add either a new MBean value or a method to obtain
> that data. We can also add a method to retrieve the first K destination as
> well.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact