tjiuming commented on a change in pull request #13833:
URL: https://github.com/apache/pulsar/pull/13833#discussion_r792552262



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/PrometheusMetricsGenerator.java
##########
@@ -160,6 +171,52 @@ private static void 
generateBrokerBasicMetrics(PulsarService pulsar, SimpleTextO
                 clusterName, Collector.Type.GAUGE, stream);
     }
 
+
+    private static void generateLedgerOffloaderMetrics(PulsarService pulsar, 
SimpleTextOutputStream stream,
+                                                       boolean 
includeTopicMetrics) {
+        List<Metrics> metricList = new LinkedList<>();
+        if (includeTopicMetrics) {
+            
pulsar.getBrokerService().getMultiLayerTopicMap().forEach((namespace, 
bundlesMap) -> {
+                bundlesMap.forEach((bundle, topicsMap) -> {
+                    topicsMap.forEach((topicName, topic) -> {
+                        if (topic instanceof PersistentTopic) {
+                            //check offlaoder
+                            PersistentTopic persistentTopic = 
(PersistentTopic) topic;
+                            LedgerOffloader offloader =
+                                    
persistentTopic.getManagedLedger().getConfig().getLedgerOffloader();
+                            if (!(offloader instanceof NullLedgerOffloader)) {
+                                try {
+                                    List<Metrics> metrics =
+                                            new LedgerOffloaderMetrics(pulsar, 
true, namespace, topicName).generate();

Review comment:
       Negative, we cannot pass `LedgerOfflaoder` to `LedgerOffloaderMetrics` 
here, because in some situation, we need to aggregate metrics in `namespace` 
level.




-- 
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]


Reply via email to