use of com.linkedin.thirdeye.dashboard.resources.AnomalyFunctionResource in project pinot by linkedin.
the class ThirdEyeAnomalyApplication method run.
@Override
public void run(final ThirdEyeAnomalyConfiguration config, final Environment environment) throws Exception {
LOG.info("Starting ThirdeyeAnomalyApplication : Scheduler {} Worker {}", config.isScheduler(), config.isWorker());
super.initDAOs();
ThirdEyeCacheRegistry.initializeCaches(config);
environment.lifecycle().manage(new Managed() {
@Override
public void start() throws Exception {
if (config.isWorker()) {
anomalyFunctionFactory = new AnomalyFunctionFactory(config.getFunctionConfigPath());
alertFilterFactory = new AlertFilterFactory(config.getAlertFilterConfigPath());
taskDriver = new TaskDriver(config, anomalyFunctionFactory, alertFilterFactory);
taskDriver.start();
}
if (config.isScheduler()) {
detectionJobScheduler = new DetectionJobScheduler();
alertFilterFactory = new AlertFilterFactory(config.getAlertFilterConfigPath());
alertFilterAutotuneFactory = new AlertFilterAutotuneFactory(config.getFilterAutotuneConfigPath());
detectionJobScheduler.start();
environment.jersey().register(new DetectionJobResource(detectionJobScheduler, alertFilterFactory, alertFilterAutotuneFactory));
environment.jersey().register(new AnomalyFunctionResource(config.getFunctionConfigPath()));
}
if (config.isMonitor()) {
monitorJobScheduler = new MonitorJobScheduler(config.getMonitorConfiguration());
monitorJobScheduler.start();
}
if (config.isAlert()) {
alertJobScheduler = new AlertJobScheduler();
alertJobScheduler.start();
// start alert scheduler v2
alertJobSchedulerV2 = new AlertJobSchedulerV2();
alertJobSchedulerV2.start();
environment.jersey().register(new AlertJobResource(alertJobScheduler, emailConfigurationDAO));
}
if (config.isMerger()) {
// anomalyFunctionFactory might have initiated if current machine is also a worker
if (anomalyFunctionFactory == null) {
anomalyFunctionFactory = new AnomalyFunctionFactory(config.getFunctionConfigPath());
}
ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
anomalyMergeExecutor = new AnomalyMergeExecutor(executorService, anomalyFunctionFactory);
anomalyMergeExecutor.start();
}
if (config.isAutoload()) {
autoLoadPinotMetricsService = new AutoLoadPinotMetricsService(config);
autoLoadPinotMetricsService.start();
}
if (config.isDataCompleteness()) {
dataCompletenessScheduler = new DataCompletenessScheduler();
dataCompletenessScheduler.start();
}
}
@Override
public void stop() throws Exception {
if (config.isWorker()) {
taskDriver.stop();
}
if (config.isScheduler()) {
detectionJobScheduler.shutdown();
}
if (config.isMonitor()) {
monitorJobScheduler.stop();
}
if (config.isAlert()) {
alertJobScheduler.shutdown();
alertJobSchedulerV2.shutdown();
}
if (config.isMerger()) {
anomalyMergeExecutor.stop();
}
if (config.isAutoload()) {
autoLoadPinotMetricsService.shutdown();
}
if (config.isDataCompleteness()) {
dataCompletenessScheduler.shutdown();
}
}
});
}
use of com.linkedin.thirdeye.dashboard.resources.AnomalyFunctionResource in project pinot by linkedin.
the class ThirdEyeDashboardApplication method run.
@Override
public void run(ThirdEyeDashboardConfiguration config, Environment env) throws Exception {
super.initDAOs();
try {
ThirdEyeCacheRegistry.initializeCaches(config);
} catch (Exception e) {
LOG.error("Exception while loading caches", e);
}
AnomalyFunctionFactory anomalyFunctionFactory = new AnomalyFunctionFactory(config.getFunctionConfigPath());
AlertFilterFactory alertFilterFactory = new AlertFilterFactory(config.getAlertFilterConfigPath());
env.jersey().register(new AnomalyFunctionResource(config.getFunctionConfigPath()));
env.jersey().register(new DashboardResource());
env.jersey().register(new CacheResource());
env.jersey().register(new AnomalyResource(anomalyFunctionFactory, alertFilterFactory));
env.jersey().register(new EmailResource(config));
env.jersey().register(new EntityManagerResource());
env.jersey().register(new IngraphMetricConfigResource());
env.jersey().register(new MetricConfigResource());
env.jersey().register(new DatasetConfigResource());
env.jersey().register(new IngraphDashboardConfigResource());
env.jersey().register(new JobResource());
env.jersey().register(new AdminResource());
env.jersey().register(new SummaryResource());
env.jersey().register(new ThirdEyeResource());
env.jersey().register(new OverrideConfigResource());
env.jersey().register(new DataResource(anomalyFunctionFactory, alertFilterFactory));
env.jersey().register(new AnomaliesResource(anomalyFunctionFactory, alertFilterFactory));
env.jersey().register(new TimeSeriesResource());
env.jersey().register(new OnboardResource());
env.jersey().register(new EventResource(config.getInformedApiUrl()));
}
Aggregations