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 2022/09/28 12:12:58 UTC

[GitHub] [pulsar] asafm commented on a diff in pull request #17852: [branch-2.9] Group prometheus metrics.

asafm commented on code in PR #17852:
URL: https://github.com/apache/pulsar/pull/17852#discussion_r982324246


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/PrometheusMetricsGenerator.java:
##########
@@ -129,6 +135,8 @@ public static void generate(PulsarService pulsar, boolean includeTopicMetrics, b
             }
             out.write(buf.array(), buf.arrayOffset(), buf.readableBytes());
         } finally {
+            //release all the metrics buffers
+            metricStreams.releaseAll();

Review Comment:
   I'm not entirely sure if this is the origin of the bug:
   
   We allocate the byte buffer, use it for the `SimpleTextOutputStream`, and then once we finish writing to it, we return the byte buffer. We can't use `finally` as is to release the byte buffer. Only when there is an exception, need to revert the allocation of this byte buffer.
   The original code is correct.
   



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