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);
}
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;
}
Aggregations