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


##########
processing/src/test/java/org/apache/druid/java/util/metrics/StubServiceEmitter.java:
##########
@@ -68,15 +71,15 @@ public void emit(Event event)
    */
   public List<Event> getEvents()
   {
-    return events;
+    return new ArrayList<>(events);
   }
 
   /**
    * Gets all the metric events emitted since the previous {@link #flush()}.
    *
    * @return Map from metric name to list of events emitted for that metric.
    */
-  public Map<String, List<ServiceMetricEventSnapshot>> getMetricEvents()
+  public Map<String, Queue<ServiceMetricEventSnapshot>> getMetricEvents()
   {
     return metricEvents;

Review Comment:
   Well, it is just for tests and not really exposed outside the class, only 
for use by the sub-class.
   
   The read until is actually very useful to process only the stuff that we 
need to process.
   
   Otherwise, we would need to pipe every new event through each existing 
condition either sync or async.
   But that would still not handle the case where a condition is registered 
later.
   I guess we could maintain a list of historical events for that purpose.
   
   But all of that just seems overkill for a simple testing use case.
   
   Please let me know if you have some other suggestions to improve this flow.



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