You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/08/11 01:15:48 UTC

[GitHub] [pulsar] Technoboy- commented on a change in pull request #11564: Add compacted topic metrics for TopicStats in CLI

Technoboy- commented on a change in pull request #11564:
URL: https://github.com/apache/pulsar/pull/11564#discussion_r686422506



##########
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:
       Sorry, mistake for this, I will focus on this.




-- 
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-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org