Technoboy- commented on a change in pull request #11564: URL: https://github.com/apache/pulsar/pull/11564#discussion_r686503868
########## File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java ########## @@ -1809,9 +1811,25 @@ public TopicStatsImpl getStats(boolean getPreciseBacklog, boolean subscriptionBa stats.lastOffloadLedgerId = ledger.getLastOffloadedLedgerId(); stats.lastOffloadSuccessTimeStamp = ledger.getLastOffloadedSuccessTimestamp(); stats.lastOffloadFailureTimeStamp = ledger.getLastOffloadedFailureTimestamp(); + stats.compactedTopicSize = getCompactorMXBean().map(stat -> stat.getCompactedTopicSize(topic)).orElse(0D); + stats.compactedTopicMsgCount = getCompactorMXBean().map(stat -> + stat.getCompactedTopicMsgCount(topic)).orElse(0L); + stats.compactedTopicRemovedEventCount = getCompactorMXBean().map(stat -> + stat.getCompactedTopicRemovedEventCount(topic)).orElse(0L); + log.info("stats : {}", stats); return stats; } + private Optional<CompactorMXBean> getCompactorMXBean() { + Compactor compactor = null; + try { + compactor = brokerService.pulsar().getCompactor(); Review comment: Hi @michaeljmarshall , I have added a new method to avoid initializing the compactor. Could you help to review ? -- 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: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org