heesung-sn commented on code in PR #19613:
URL: https://github.com/apache/pulsar/pull/19613#discussion_r1119150532
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/reporter/BrokerLoadDataReporter.java:
##########
@@ -77,12 +79,18 @@ public BrokerLoadData generateLoadData() {
final var pulsarStats = pulsar.getBrokerService().getPulsarStats();
synchronized (pulsarStats) {
var brokerStats = pulsarStats.getBrokerStats();
+ var bundleStats = pulsarStats.getBundleStats();
+ var topics = 0;
+ for (Map.Entry<String, NamespaceBundleStats> bundleStatsEntry :
bundleStats.entrySet()) {
Review Comment:
Can we define `topics` in `BrokerStats` and pre-aggregate this topic counts
in `updateStats`?
```
public synchronized void updateStats(
ConcurrentOpenHashMap<String, ConcurrentOpenHashMap<String,
ConcurrentOpenHashMap<String, Topic>>>
topicsMap) {
...
bundles.forEach((bundle, topics) -> {
NamespaceBundleStats currentBundleStats =
bundleStats.computeIfAbsent(bundle,
k -> new NamespaceBundleStats());
currentBundleStats.reset();
currentBundleStats.topics = topics.size();
brokerStats.topics += topics.size(); //pre-aggregate
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]