shauryachats commented on code in PR #14064:
URL: https://github.com/apache/pinot/pull/14064#discussion_r1775981838


##########
pinot-common/src/test/java/org/apache/pinot/common/metrics/AbstractMetricsTest.java:
##########
@@ -268,4 +274,157 @@ public void testMeteredMetrics() {
     
testMetrics.getMetricsRegistry().allMetrics().keySet().forEach(testMetrics.getMetricsRegistry()::removeMetric);
     Assert.assertTrue(testMetrics.getMetricsRegistry().allMetrics().isEmpty());
   }
+
+  @Test
+  public void testGlobalGaugeMetricsAsyncAddRemove() throws 
ExecutionException, InterruptedException {
+    ControllerMetrics controllerMetrics = buildTestMetrics();
+    int gaugeOperationsRuntimeMs = 100;
+
+    ExecutorService executorService = Executors.newFixedThreadPool(2);
+    long endTime = System.currentTimeMillis() + gaugeOperationsRuntimeMs;
+
+    Future<?> addFuture = executorService.submit(() -> {
+      while (System.currentTimeMillis() < endTime + gaugeOperationsRuntimeMs) {
+        controllerMetrics.addValueToGlobalGauge(ControllerGauge.VERSION, 1L);

Review Comment:
   Since `addValueToGlobalGauge` has significant usage, I would keep that test 
and also add a separate async test for `setValueOfGauge`.



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

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


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

Reply via email to