codelipenghui commented on code in PR #17041:
URL: https://github.com/apache/pulsar/pull/17041#discussion_r944063001


##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/PrometheusMetricsTest.java:
##########
@@ -1522,6 +1517,83 @@ public void testSplitTopicAndPartitionLabel() throws 
Exception {
         consumer2.close();
     }
 
+
+    @Test
+    public void testMetadataStoreStats() throws Exception {
+        String ns = "prop/ns-abc1";
+        admin.namespaces().createNamespace(ns);
+
+        String topic = "persistent://prop/ns-abc1/metadata-store-" + 
UUID.randomUUID();
+        String subName = "my-sub1";
+
+        @Cleanup
+        Producer<String> producer = pulsarClient.newProducer(Schema.STRING)
+                .topic(topic).create();
+        @Cleanup
+        Consumer<String> consumer = pulsarClient.newConsumer(Schema.STRING)
+                .topic(topic).subscriptionName(subName).subscribe();
+
+        for (int i = 0; i < 100; i++) {
+            producer.newMessage().value(UUID.randomUUID().toString()).send();
+        }
+
+        for (;;) {
+            Message<String> message = consumer.receive(10, TimeUnit.SECONDS);
+            if (message == null) {
+                break;
+            }
+            consumer.acknowledge(message);
+        }
+
+        ByteArrayOutputStream output = new ByteArrayOutputStream();
+        PrometheusMetricsGenerator.generate(pulsar, false, false, false, 
false, output);
+        String metricsStr = output.toString();
+        Multimap<String, Metric> metricsMap = parseMetrics(metricsStr);
+
+        Collection<Metric> getOpsFailed = 
metricsMap.get("pulsar_metadata_store_get_ops_failed" + "_total");
+        Collection<Metric> delOpsFailed = 
metricsMap.get("pulsar_metadata_store_del_ops_failed" + "_total");
+        Collection<Metric> putOpsFailed = 
metricsMap.get("pulsar_metadata_store_put_ops_failed" + "_total");
+
+        Collection<Metric> getOpsLatency = 
metricsMap.get("pulsar_metadata_store_get_ops_latency" + "_sum");
+        Collection<Metric> delOpsLatency = 
metricsMap.get("pulsar_metadata_store_del_ops_latency" + "_sum");
+        Collection<Metric> putOpsLatency = 
metricsMap.get("pulsar_metadata_store_put_ops_latency" + "_sum");
+
+        Collection<Metric> putBytes = 
metricsMap.get("pulsar_metadata_store_put_bytes" + "_total");
+
+        Assert.assertTrue(getOpsFailed.size() > 0);

Review Comment:
   I think we can update the checkstyle like this 
https://lightrun.com/answers/checkstyle-checkstyle-illegalimport-does-not-warn-about-static-imports
   
   There are many places are using `Assert.assert`



-- 
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-unsubscr...@pulsar.apache.org

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

Reply via email to