ifesdjeen commented on code in PR #4271:
URL: https://github.com/apache/cassandra/pull/4271#discussion_r2235946604


##########
test/distributed/org/apache/cassandra/distributed/test/accord/AccordMetricsTest.java:
##########
@@ -237,23 +250,47 @@ public void testTimeoutMetrics()
             
Assertions.assertThat(ex).is(AssertionUtils.rootCauseIs(WriteTimeoutException.class));
         }
 
-        assertCoordinatorMetrics(0, "rw", 0, 0, 0, 1, 0);
+        assertClientMetrics(0, "AccordWrite", 0, 1);
+        assertClientMetrics(1, "AccordWrite", 0, 0);
+        // TODO (required): reenable or remove metric
+//        assertCoordinatorMetrics(0, "rw", 0, 0, 0, 1, 0);
         assertCoordinatorMetrics(1, "rw", 0, 0, 0, 0, 0);
         assertReplicaMetrics(0, "rw", 0, 0, 0);
         assertReplicaMetrics(1, "rw", 0, 0, 0);
 
-        assertZeroMetrics("ro");
+        assertZeroMetrics("ro","AccordRead");
     }
 
-    private void assertZeroMetrics(String scope)
+    private void assertZeroMetrics(String scope, String clientScope)
     {
         for (int i = 0; i < SHARED_CLUSTER.size(); i++)
         {
+            assertClientMetrics(0, clientScope, 0, 0);
             assertCoordinatorMetrics(i, scope, 0, 0, 0, 0, 0);
             assertReplicaMetrics(i, scope, 0, 0, 0);
         }
     }
 
+    private void assertClientMetrics(int node, String scope, long preempts, 
long timeouts)
+    {
+        DefaultNameFactory nameFactory = new 
DefaultNameFactory("ClientRequest", scope);
+        Map<String, Long> metrics = diff(countingMetrics0).get(node);
+        logger.info("Metrics for node {} / {}: {}", node, scope, metrics);
+        Function<String, Long> metric = n -> 
metrics.get(nameFactory.createMetricName(n).getMetricName());
+        assertThat(metric.apply("Preempted")).isEqualTo(preempts);
+        assertThat(metric.apply("Timeouts")).isEqualTo(timeouts);
+
+        // Verify that coordinator metrics are published to the appropriate 
virtual table:

Review Comment:
   Do we want this check here still?



-- 
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: pr-unsubscr...@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to