Search in sources :

Example 1 with MonitorScheduler

use of com.metamx.metrics.MonitorScheduler in project druid by druid-io.

the class MetricsModule method getMonitorScheduler.

@Provides
@ManageLifecycle
public MonitorScheduler getMonitorScheduler(Supplier<DruidMonitorSchedulerConfig> config, MonitorsConfig monitorsConfig, Set<Class<? extends Monitor>> monitorSet, ServiceEmitter emitter, Injector injector) {
    List<Monitor> monitors = Lists.newArrayList();
    for (Class<? extends Monitor> monitorClass : Iterables.concat(monitorsConfig.getMonitors(), monitorSet)) {
        final Monitor monitor = injector.getInstance(monitorClass);
        log.info("Adding monitor[%s]", monitor);
        monitors.add(monitor);
    }
    return new MonitorScheduler(config.get(), Execs.scheduledSingleThreaded("MonitorScheduler-%s"), emitter, monitors);
}
Also used : ExecutorServiceMonitor(io.druid.query.ExecutorServiceMonitor) Monitor(com.metamx.metrics.Monitor) JvmCpuMonitor(com.metamx.metrics.JvmCpuMonitor) JvmMonitor(com.metamx.metrics.JvmMonitor) SysMonitor(com.metamx.metrics.SysMonitor) MonitorScheduler(com.metamx.metrics.MonitorScheduler) ManageLifecycle(io.druid.guice.ManageLifecycle) Provides(com.google.inject.Provides)

Example 2 with MonitorScheduler

use of com.metamx.metrics.MonitorScheduler in project druid by druid-io.

the class TaskLifecycleTest method setUp.

@Before
public void setUp() throws Exception {
    // mock things
    queryRunnerFactoryConglomerate = EasyMock.createStrictMock(QueryRunnerFactoryConglomerate.class);
    monitorScheduler = EasyMock.createStrictMock(MonitorScheduler.class);
    // initialize variables
    announcedSinks = 0;
    pushedSegments = 0;
    indexSpec = new IndexSpec();
    emitter = newMockEmitter();
    EmittingLogger.registerEmitter(emitter);
    mapper = TEST_UTILS.getTestObjectMapper();
    handOffCallbacks = Maps.newConcurrentMap();
    // Set up things, the order does matter as if it is messed up then the setUp
    // should fail because of the Precondition checks in the respective setUp methods
    // For creating a customized TaskQueue see testRealtimeIndexTaskFailure test
    taskStorage = setUpTaskStorage();
    handoffNotifierFactory = setUpSegmentHandOffNotifierFactory();
    dataSegmentPusher = setUpDataSegmentPusher();
    mdc = setUpMetadataStorageCoordinator();
    tb = setUpTaskToolboxFactory(dataSegmentPusher, handoffNotifierFactory, mdc);
    taskRunner = setUpThreadPoolTaskRunner(tb);
    taskQueue = setUpTaskQueue(taskStorage, taskRunner);
}
Also used : QueryRunnerFactoryConglomerate(io.druid.query.QueryRunnerFactoryConglomerate) IndexSpec(io.druid.segment.IndexSpec) MonitorScheduler(com.metamx.metrics.MonitorScheduler) Before(org.junit.Before)

Aggregations

MonitorScheduler (com.metamx.metrics.MonitorScheduler)2 Provides (com.google.inject.Provides)1 JvmCpuMonitor (com.metamx.metrics.JvmCpuMonitor)1 JvmMonitor (com.metamx.metrics.JvmMonitor)1 Monitor (com.metamx.metrics.Monitor)1 SysMonitor (com.metamx.metrics.SysMonitor)1 ManageLifecycle (io.druid.guice.ManageLifecycle)1 ExecutorServiceMonitor (io.druid.query.ExecutorServiceMonitor)1 QueryRunnerFactoryConglomerate (io.druid.query.QueryRunnerFactoryConglomerate)1 IndexSpec (io.druid.segment.IndexSpec)1 Before (org.junit.Before)1