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


##########
processing/src/test/java/org/apache/druid/java/util/metrics/StubServiceEmitter.java:
##########
@@ -41,18 +44,32 @@
  */
 public class StubServiceEmitter extends ServiceEmitter implements 
MetricsVerifier
 {
+  public static final String TYPE = "stub";
+
   private final Deque<Event> events = new ConcurrentLinkedDeque<>();
   private final Deque<AlertEvent> alertEvents = new ConcurrentLinkedDeque<>();
   private final ConcurrentHashMap<String, Deque<ServiceMetricEvent>> 
metricEvents = new ConcurrentHashMap<>();
 
   public StubServiceEmitter()
   {
-    super("testing", "localhost", null);
+    this("testing", "localhost");
   }
 
+  /**
+   * Initialize a stub service emitter and auto-{@link #start()}  it for test 
convenience.
+   */
   public StubServiceEmitter(String service, String host)
   {
-    super(service, host, null);
+    this(service, host, new NoopTaskHolder());
+    super.start();
+  }
+
+  /**
+   * Initialize a stub service emitter. Tests must explicitly call {@link 
#start()}.
+   */
+  public StubServiceEmitter(String service, String host, TaskHolder taskHolder)

Review Comment:
   >We should update the LatchableEmitter constructor to accept a TaskHolder 
too.
   Otherwise, the task dimensions will not show up in embedded tests.
   
   Sounds good, updated.
   
   >Oh, I suppose this would require MMs. You could add a metric verification 
in the KubernetesTaskRunnerDockerTest since that test runs peons and also uses 
an event collector + latchable emitter combo to wait on metrics.
   
   I’m trying to figure out how to run the Docker tests locally to verify 
this...I’m looking at the GHA Docker tests to see what I’m missing in my setup. 
It would probably be a good idea to add a brief README or update the javadocs, 
to document how devs can run these tests locally, since it requires some 
additional setup like installing dependencies like k3s, etc.



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