codelipenghui commented on code in PR #16672:
URL: https://github.com/apache/pulsar/pull/16672#discussion_r953397190
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java:
##########
@@ -1088,6 +1088,13 @@ public SubscriptionStatsImpl getStats(Boolean
getPreciseBacklog, boolean subscri
consumerStats.keyHashRanges =
consumerKeyHashRanges.get(consumer).stream()
.map(Range::toString)
.collect(Collectors.toList());
+ long sameNameConsumerCount = consumerKeyHashRanges.keySet()
+ .stream()
+ .filter(c ->
c.consumerName().equals(consumer.consumerName()))
+ .count();
Review Comment:
Can we get the consumer count without going through all the items of
consumerKeyHashRanges? If we have many consumers under a topic, this might
introduce CPU spike
--
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]