use of org.apache.druid.java.util.emitter.core.Event in project druid by druid-io.
the class SeekableStreamSupervisorStateTest method testEmitNoticesQueueSize.
@Test
public void testEmitNoticesQueueSize() throws Exception {
expectEmitterSupervisor(false);
CountDownLatch latch = new CountDownLatch(1);
TestEmittingTestSeekableStreamSupervisor supervisor = new TestEmittingTestSeekableStreamSupervisor(latch, null, null);
supervisor.start();
Assert.assertTrue(supervisor.stateManager.isHealthy());
Assert.assertEquals(BasicState.PENDING, supervisor.stateManager.getSupervisorState());
Assert.assertEquals(BasicState.PENDING, supervisor.stateManager.getSupervisorState().getBasicState());
Assert.assertTrue(supervisor.stateManager.getExceptionEvents().isEmpty());
Assert.assertFalse(supervisor.stateManager.isAtLeastOneSuccessfulRun());
latch.await();
List<Event> events = emitter.getEvents();
List<String> whitelist = Collections.singletonList("ingest/notices/queueSize");
events = filterMetrics(events, whitelist);
Assert.assertEquals(1, events.size());
Assert.assertEquals("ingest/notices/queueSize", events.get(0).toMap().get("metric"));
Assert.assertEquals(0, events.get(0).toMap().get("value"));
Assert.assertEquals("testDS", events.get(0).toMap().get("dataSource"));
verifyAll();
}
use of org.apache.druid.java.util.emitter.core.Event in project druid by druid-io.
the class SeekableStreamSupervisorStateTest method testEmitNoLagWhenSuspended.
@Test
public void testEmitNoLagWhenSuspended() throws Exception {
expectEmitterSupervisor(true);
CountDownLatch latch = new CountDownLatch(2);
TestEmittingTestSeekableStreamSupervisor supervisor = new TestEmittingTestSeekableStreamSupervisor(latch, ImmutableMap.of("1", 100L, "2", 250L, "3", 500L), ImmutableMap.of("1", 10000L, "2", 15000L, "3", 20000L));
supervisor.start();
supervisor.runInternal();
Assert.assertTrue(supervisor.stateManager.isHealthy());
Assert.assertEquals(BasicState.SUSPENDED, supervisor.stateManager.getSupervisorState());
Assert.assertEquals(BasicState.SUSPENDED, supervisor.stateManager.getSupervisorState().getBasicState());
Assert.assertTrue(supervisor.stateManager.getExceptionEvents().isEmpty());
latch.await();
List<Event> events = emitter.getEvents();
List<String> whitelist = Arrays.asList("ingest/test/lag", "ingest/test/maxLag", "ingest/test/avgLag", "ingest/test/lag/time", "ingest/test/maxLag/time", "ingest/test/avgLag/time");
events = filterMetrics(events, whitelist);
Assert.assertEquals(0, events.size());
verifyAll();
}
use of org.apache.druid.java.util.emitter.core.Event in project druid by druid-io.
the class SeekableStreamSupervisorStateTest method testEmitNoticesTime.
@Test
public void testEmitNoticesTime() throws Exception {
expectEmitterSupervisor(false);
CountDownLatch latch = new CountDownLatch(2);
TestEmittingTestSeekableStreamSupervisor supervisor = new TestEmittingTestSeekableStreamSupervisor(latch, null, null);
supervisor.start();
supervisor.emitNoticesTime();
Assert.assertTrue(supervisor.stateManager.isHealthy());
Assert.assertEquals(BasicState.PENDING, supervisor.stateManager.getSupervisorState());
Assert.assertEquals(BasicState.PENDING, supervisor.stateManager.getSupervisorState().getBasicState());
Assert.assertTrue(supervisor.stateManager.getExceptionEvents().isEmpty());
Assert.assertFalse(supervisor.stateManager.isAtLeastOneSuccessfulRun());
latch.await();
List<Event> events = emitter.getEvents();
List<String> whitelist = Collections.singletonList("ingest/notices/time");
events = filterMetrics(events, whitelist);
Assert.assertEquals(1, events.size());
Assert.assertEquals("ingest/notices/time", events.get(0).toMap().get("metric"));
Assert.assertEquals(500L, events.get(0).toMap().get("value"));
Assert.assertEquals("testDS", events.get(0).toMap().get("dataSource"));
Assert.assertEquals("dummyNoticeType", events.get(0).toMap().get("noticeType"));
verifyAll();
}
use of org.apache.druid.java.util.emitter.core.Event in project druid by druid-io.
the class MetricsEmittingQueryProcessingPoolTest method testPrioritizedExecutorDelegate.
@Test
public void testPrioritizedExecutorDelegate() {
PrioritizedExecutorService service = Mockito.mock(PrioritizedExecutorService.class);
Mockito.when(service.getQueueSize()).thenReturn(10);
ExecutorServiceMonitor monitor = new ExecutorServiceMonitor();
List<Event> events = new ArrayList<>();
MetricsEmittingQueryProcessingPool processingPool = new MetricsEmittingQueryProcessingPool(service, monitor);
Assert.assertSame(service, processingPool.delegate());
ServiceEmitter serviceEmitter = new ServiceEmitter("service", "host", Mockito.mock(Emitter.class)) {
@Override
public void emit(Event event) {
events.add(event);
}
};
monitor.doMonitor(serviceEmitter);
Assert.assertEquals(1, events.size());
Assert.assertEquals(((ServiceMetricEvent) (events.get(0))).getMetric(), "segment/scan/pending");
Assert.assertEquals(((ServiceMetricEvent) (events.get(0))).getValue(), 10);
}
use of org.apache.druid.java.util.emitter.core.Event in project druid by druid-io.
the class LookupCoordinatorManagerTest method setUpStatic.
@BeforeClass
public static void setUpStatic() {
LoggingEmitter loggingEmitter = EasyMock.createNiceMock(LoggingEmitter.class);
EasyMock.replay(loggingEmitter);
SERVICE_EMITTER = new ServiceEmitter("", "", loggingEmitter) {
@Override
public void emit(Event event) {
EVENT_EMITS.incrementAndGet();
super.emit(event);
}
};
EmittingLogger.registerEmitter(SERVICE_EMITTER);
}
Aggregations