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


##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/PrometheusMetricsTest.java:
##########
@@ -1557,49 +1557,40 @@ public void testMetadataStoreStats() throws Exception {
         String metricsStr = output.toString();
         Multimap<String, Metric> metricsMap = parseMetrics(metricsStr);
 
-        Collection<Metric> getOpsFailed = 
metricsMap.get("pulsar_metadata_store_get_failed" + "_total");
-        Collection<Metric> delOpsFailed = 
metricsMap.get("pulsar_metadata_store_del_failed" + "_total");
-        Collection<Metric> putOpsFailed = 
metricsMap.get("pulsar_metadata_store_put_failed" + "_total");
-
-        Collection<Metric> getOpsLatency = 
metricsMap.get("pulsar_metadata_store_get_latency_ms" + "_sum");
-        Collection<Metric> delOpsLatency = 
metricsMap.get("pulsar_metadata_store_del_latency_ms" + "_sum");
-        Collection<Metric> putOpsLatency = 
metricsMap.get("pulsar_metadata_store_put_latency_ms" + "_sum");
-
+        Collection<Metric> opsFailed = 
metricsMap.get("pulsar_metadata_store_ops_failed" + "_total");
+        Collection<Metric> opsLatency = 
metricsMap.get("pulsar_metadata_store_ops_latency_ms" + "_sum");
         Collection<Metric> putBytes = 
metricsMap.get("pulsar_metadata_store_put_bytes" + "_total");
 
-        Assert.assertTrue(getOpsFailed.size() > 1);
-        Assert.assertTrue(delOpsFailed.size() > 1);
-        Assert.assertTrue(putOpsFailed.size() > 1);
-        Assert.assertTrue(getOpsLatency.size() > 1);
-        Assert.assertTrue(delOpsLatency.size() > 1);
-        Assert.assertTrue(putOpsLatency.size() > 1);
+        Assert.assertTrue(opsFailed.size() > 1);
+        Assert.assertTrue(opsLatency.size() > 1);
         Assert.assertTrue(putBytes.size() > 1);
 
-        for (Metric m : getOpsFailed) {
-            Assert.assertEquals(m.tags.get("cluster"), "test");
-            Assert.assertTrue(m.tags.get("name").startsWith("metadata-store"));
-        }
-        for (Metric m : delOpsFailed) {
-            Assert.assertEquals(m.tags.get("cluster"), "test");
-            Assert.assertTrue(m.tags.get("name").startsWith("metadata-store"));
-        }
-        for (Metric m : putOpsFailed) {
-            Assert.assertEquals(m.tags.get("cluster"), "test");
-            Assert.assertTrue(m.tags.get("name").startsWith("metadata-store"));
-        }
-        for (Metric m : getOpsLatency) {
-            Assert.assertEquals(m.tags.get("cluster"), "test");
-            Assert.assertTrue(m.tags.get("name").startsWith("metadata-store"));
-            Assert.assertTrue(m.value > 0);
-        }
-        for (Metric m : delOpsLatency) {
+        for (Metric m : opsFailed) {
             Assert.assertEquals(m.tags.get("cluster"), "test");
             Assert.assertTrue(m.tags.get("name").startsWith("metadata-store"));
+            if (m.tags.get("type").equals("get")) {
+                Assert.assertTrue(m.value >= 0);

Review Comment:
   Out of curiosity: Why? You are a word which adds not value
   
   If I read `assertTrue(m.value >=0)`, it's much easier that 
`Assert.assertThat(m.value >0)` since the word assert is already present in the 
method name - it's like saying "Assert assert value > 0" - doesn't sound right.
   



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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to