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:
[email protected]