abhishekrb19 commented on code in PR #18855:
URL: https://github.com/apache/druid/pull/18855#discussion_r2636507321


##########
indexing-service/src/test/java/org/apache/druid/indexing/common/TaskRealtimeMetricsMonitorTest.java:
##########
@@ -127,6 +131,151 @@ public void testMessageGapAggStats()
     
Assert.assertTrue(emittedEvents.containsKey("ingest/events/avgMessageGap"));
   }
 
+  @Test
+  public void testThrownAwayEmitsReasonDimension()
+  {
+    SimpleRowIngestionMeters realMeters = new SimpleRowIngestionMeters();
+    realMeters.incrementThrownAway(ThrownAwayReason.NULL);
+    realMeters.incrementThrownAway(ThrownAwayReason.NULL);
+    realMeters.incrementThrownAway(ThrownAwayReason.BEFORE_MIN_MESSAGE_TIME);
+    realMeters.incrementThrownAway(ThrownAwayReason.BEFORE_MIN_MESSAGE_TIME);
+    realMeters.incrementThrownAway(ThrownAwayReason.BEFORE_MIN_MESSAGE_TIME);
+    realMeters.incrementThrownAway(ThrownAwayReason.AFTER_MAX_MESSAGE_TIME);
+    realMeters.incrementThrownAway(ThrownAwayReason.FILTERED);
+    realMeters.incrementThrownAway(ThrownAwayReason.FILTERED);
+    realMeters.incrementThrownAway(ThrownAwayReason.FILTERED);
+    realMeters.incrementThrownAway(ThrownAwayReason.FILTERED);
+
+    List<ServiceMetricEvent> allEmittedEvents = new ArrayList<>();
+    ServiceEmitter captureEmitter = Mockito.mock(ServiceEmitter.class);
+    
Mockito.doCallRealMethod().when(captureEmitter).emit(ArgumentMatchers.any(ServiceEventBuilder.class));
+    Mockito
+        .doAnswer(invocation -> {
+          ServiceMetricEvent e = invocation.getArgument(0);
+          allEmittedEvents.add(e);
+          return null;
+        })
+        .when(captureEmitter).emit(ArgumentMatchers.any(Event.class));
+

Review Comment:
   Could we use `StubServiceEmitter` instead of a mocked `ServiceEmitter` for 
these new tests? It should simplify this test code & make it more readable. We 
can migrate the existing tests that use mocked emitter separately.



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