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 2018/02/06 17:32:15 UTC

[GitHub] jai1 commented on a change in pull request #1185: Fixed storage latency stats with Prometheus

jai1 commented on a change in pull request #1185: Fixed storage latency stats with Prometheus
URL: https://github.com/apache/incubator-pulsar/pull/1185#discussion_r166381806
 
 

 ##########
 File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/NamespaceStatsAggregator.java
 ##########
 @@ -36,38 +36,54 @@ protected AggregatedNamespaceStats initialValue() throws Exception {
         }
     };
 
+    private static FastThreadLocal<TopicStats> localTopicStats = new FastThreadLocal<TopicStats>() {
+        @Override
+        protected TopicStats initialValue() throws Exception {
+            return new TopicStats();
+        }
+    };
+
     public static void generate(PulsarService pulsar, boolean includeTopicMetrics, SimpleTextOutputStream stream) {
         String cluster = pulsar.getConfiguration().getClusterName();
         AggregatedNamespaceStats namespaceStats = localNamespaceStats.get();
-        TopicStats topicStats = new TopicStats();
+        TopicStats topicStats = localTopicStats.get();
 
         pulsar.getBrokerService().getMultiLayerTopicMap().forEach((namespace, bundlesMap) -> {
             namespaceStats.reset();
 
             bundlesMap.forEach((bundle, topicsMap) -> {
                 topicsMap.forEach((name, topic) -> {
                     getTopicStats(topic, topicStats);
-                    namespaceStats.updateStats(topicStats);
+
 
 Review comment:
   Don't understand the reasoning for 
   
   namespaceStats.updateStats(topicStats);  only if includeTopicMetrics == false

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services