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/05/12 08:34:41 UTC

[GitHub] [pulsar] 315157973 opened a new pull request #10553: Expose topic-level averageMsgSize to metrics

315157973 opened a new pull request #10553:
URL: https://github.com/apache/pulsar/pull/10553


   ### Motivation
   Now there is a record of average_msg_size in code, but it is not exposed.
   
   ### Modifications
   Expose topic-level averageMsgSize to metrics
   
   ### Verifying this change
   


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

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



[GitHub] [pulsar] gaoran10 commented on a change in pull request #10553: Expose topic-level averageMsgSize to metrics

Posted by GitBox <gi...@apache.org>.
gaoran10 commented on a change in pull request #10553:
URL: https://github.com/apache/pulsar/pull/10553#discussion_r630905193



##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/PrometheusMetricsTest.java
##########
@@ -89,24 +89,26 @@ protected void cleanup() throws Exception {
     }
 
     @Test
-    public void testMetricsTopicCount() throws Exception {
+    public void testMetricsTopicCountAndAvgMsgSize() throws Exception {
         String ns1 = "prop/ns-abc1";
         String ns2 = "prop/ns-abc2";
         admin.namespaces().createNamespace(ns1);
         admin.namespaces().createNamespace(ns2);
         String baseTopic1 = "persistent://" + ns1 + "/testMetricsTopicCount";
         String baseTopic2 = "persistent://" + ns2 + "/testMetricsTopicCount";
         for (int i = 0; i < 6; i++) {
-            admin.topics().createNonPartitionedTopic(baseTopic1 + UUID.randomUUID().toString());
+            admin.topics().createNonPartitionedTopic(baseTopic1 + UUID.randomUUID());
         }
         for (int i = 0; i < 3; i++) {
-            admin.topics().createNonPartitionedTopic(baseTopic2 + UUID.randomUUID().toString());
+            admin.topics().createNonPartitionedTopic(baseTopic2 + UUID.randomUUID());
         }
         Thread.sleep(ASYNC_EVENT_COMPLETION_WAIT);
         ByteArrayOutputStream statsOut = new ByteArrayOutputStream();
         PrometheusMetricsGenerator.generate(pulsar, true, false, false, statsOut);
         String metricsStr = statsOut.toString();
         Multimap<String, Metric> metrics = parseMetrics(metricsStr);
+        assertTrue(metrics.containsKey("pulsar_average_msg_size"));
+        assertEquals(metrics.get("pulsar_average_msg_size").size(), 9);

Review comment:
       Do we need to check the value of the `pulsar_average_msg_size`? For example, produce some messages and check the `pulsar_average_msg_size`.




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

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



[GitHub] [pulsar] gaoran10 commented on pull request #10553: Expose topic-level averageMsgSize to metrics

Posted by GitBox <gi...@apache.org>.
gaoran10 commented on pull request #10553:
URL: https://github.com/apache/pulsar/pull/10553#issuecomment-839650007


   Do we need to check the value of the `pulsar_average_msg_size`? For example, produce some messages and check the `pulsar_average_msg_size`.


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

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



[GitHub] [pulsar] eolivelli merged pull request #10553: Expose topic-level averageMsgSize to metrics

Posted by GitBox <gi...@apache.org>.
eolivelli merged pull request #10553:
URL: https://github.com/apache/pulsar/pull/10553


   


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

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