Search in sources :

Example 1 with ManageLifecycle

use of io.druid.guice.ManageLifecycle 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 ManageLifecycle

use of io.druid.guice.ManageLifecycle in project druid by druid-io.

the class EmitterModule method getServiceEmitter.

@Provides
@ManageLifecycle
public ServiceEmitter getServiceEmitter(@Self Supplier<DruidNode> configSupplier, Emitter emitter) {
    final DruidNode config = configSupplier.get();
    String version = getClass().getPackage().getImplementationVersion();
    final ImmutableMap<String, String> otherServiceDimensions = ImmutableMap.of("version", // Version is null during `mvn test`.
    Strings.nullToEmpty(version));
    final ServiceEmitter retVal = new ServiceEmitter(config.getServiceName(), config.getHostAndPort(), emitter, otherServiceDimensions);
    EmittingLogger.registerEmitter(retVal);
    return retVal;
}
Also used : ServiceEmitter(com.metamx.emitter.service.ServiceEmitter) DruidNode(io.druid.server.DruidNode) ManageLifecycle(io.druid.guice.ManageLifecycle) Provides(com.google.inject.Provides)

Aggregations

Provides (com.google.inject.Provides)2 ManageLifecycle (io.druid.guice.ManageLifecycle)2 ServiceEmitter (com.metamx.emitter.service.ServiceEmitter)1 JvmCpuMonitor (com.metamx.metrics.JvmCpuMonitor)1 JvmMonitor (com.metamx.metrics.JvmMonitor)1 Monitor (com.metamx.metrics.Monitor)1 MonitorScheduler (com.metamx.metrics.MonitorScheduler)1 SysMonitor (com.metamx.metrics.SysMonitor)1 ExecutorServiceMonitor (io.druid.query.ExecutorServiceMonitor)1 DruidNode (io.druid.server.DruidNode)1