kfaraz commented on code in PR #18742:
URL: https://github.com/apache/druid/pull/18742#discussion_r2542187369


##########
processing/src/test/java/org/apache/druid/java/util/metrics/StubServiceEmitter.java:
##########
@@ -123,6 +124,28 @@ public List<Number> getMetricValues(
     return values;
   }
 
+  public int getMetricEventCount(String metricName)
+  {
+    final Queue<ServiceMetricEvent> metricEventQueue = 
metricEvents.get(metricName);
+    return metricEventQueue == null ? 0 : metricEventQueue.size();
+  }
+
+  public long getMetricEventLongSum(String metricName)
+  {
+    final Queue<ServiceMetricEvent> metricEventQueue = 
metricEvents.get(metricName);
+    long total = 0;
+    for (ServiceMetricEvent event : metricEventQueue) {
+      total += event.getValue().longValue();
+    }
+    return total;
+  }
+
+  public Number getLatestMetricEventValue(String metricName)
+  {
+    final Deque<ServiceMetricEvent> metricEventQueue = 
metricEvents.get(metricName);
+    return metricEventQueue == null ? 0 : 
metricEventQueue.getLast().getValue();

Review Comment:
   Nit: should we return `null` if there has been no event?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to