Search in sources :

Example 1 with CacheResource

use of com.linkedin.thirdeye.dashboard.resources.CacheResource 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()));
}
Also used : EntityManagerResource(com.linkedin.thirdeye.dashboard.resources.EntityManagerResource) AlertFilterFactory(com.linkedin.thirdeye.detector.email.filter.AlertFilterFactory) TimeSeriesResource(com.linkedin.thirdeye.dashboard.resources.v2.TimeSeriesResource) AnomalyResource(com.linkedin.thirdeye.dashboard.resources.AnomalyResource) JobResource(com.linkedin.thirdeye.dashboard.resources.JobResource) AnomalyFunctionResource(com.linkedin.thirdeye.dashboard.resources.AnomalyFunctionResource) EmailResource(com.linkedin.thirdeye.dashboard.resources.EmailResource) IngraphMetricConfigResource(com.linkedin.thirdeye.dashboard.resources.IngraphMetricConfigResource) AdminResource(com.linkedin.thirdeye.dashboard.resources.AdminResource) DataResource(com.linkedin.thirdeye.dashboard.resources.v2.DataResource) EventResource(com.linkedin.thirdeye.dashboard.resources.v2.EventResource) ThirdEyeResource(com.linkedin.thirdeye.dashboard.resources.ThirdEyeResource) AnomaliesResource(com.linkedin.thirdeye.dashboard.resources.v2.AnomaliesResource) MetricConfigResource(com.linkedin.thirdeye.dashboard.resources.MetricConfigResource) IngraphMetricConfigResource(com.linkedin.thirdeye.dashboard.resources.IngraphMetricConfigResource) IngraphDashboardConfigResource(com.linkedin.thirdeye.dashboard.resources.IngraphDashboardConfigResource) CacheResource(com.linkedin.thirdeye.dashboard.resources.CacheResource) OverrideConfigResource(com.linkedin.thirdeye.dashboard.resources.OverrideConfigResource) DashboardResource(com.linkedin.thirdeye.dashboard.resources.DashboardResource) AnomalyFunctionFactory(com.linkedin.thirdeye.detector.function.AnomalyFunctionFactory) OnboardResource(com.linkedin.thirdeye.dashboard.resources.OnboardResource) DatasetConfigResource(com.linkedin.thirdeye.dashboard.resources.DatasetConfigResource) SummaryResource(com.linkedin.thirdeye.dashboard.resources.SummaryResource)

Example 2 with CacheResource

use of com.linkedin.thirdeye.dashboard.resources.CacheResource in project pinot by linkedin.

the class ThirdEyeCacheRegistry method initPeriodicCacheRefresh.

private static void initPeriodicCacheRefresh() {
    final CacheResource cacheResource = new CacheResource();
    // manually refreshing on startup, and setting delay
    // as weeklyService starts before hourlyService finishes,
    // causing NPE in reading collectionsCache
    // Start initial cache loading asynchronously to reduce application start time
    Executors.newSingleThreadExecutor().submit(() -> {
        cacheResource.refreshCollections();
        cacheResource.refreshDatasetConfigCache();
        cacheResource.refreshDashoardConfigsCache();
        cacheResource.refreshDashboardsCache();
        cacheResource.refreshMetricConfigCache();
        cacheResource.refreshMaxDataTimeCache();
        cacheResource.refreshDimensionFiltersCache();
    });
    ScheduledExecutorService minuteService = Executors.newSingleThreadScheduledExecutor();
    minuteService.scheduleAtFixedRate(new Runnable() {

        @Override
        public void run() {
            try {
                cacheResource.refreshMaxDataTimeCache();
            } catch (Exception e) {
                LOGGER.error("Exception while loading collections", e);
            }
        }
    }, 30, 30, TimeUnit.MINUTES);
    ScheduledExecutorService hourlyService = Executors.newSingleThreadScheduledExecutor();
    hourlyService.scheduleAtFixedRate(new Runnable() {

        @Override
        public void run() {
            try {
                cacheResource.refreshCollections();
            } catch (Exception e) {
                LOGGER.error("Exception while loading collections", e);
            }
        }
    }, 1, 1, TimeUnit.HOURS);
    ScheduledExecutorService weeklyService = Executors.newSingleThreadScheduledExecutor();
    weeklyService.scheduleAtFixedRate(new Runnable() {

        @Override
        public void run() {
            try {
                cacheResource.refreshDimensionFiltersCache();
            } catch (Exception e) {
                LOGGER.error("Exception while loading filter caches", e);
            }
        }
    }, 7, 7, TimeUnit.DAYS);
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) CacheResource(com.linkedin.thirdeye.dashboard.resources.CacheResource)

Aggregations

CacheResource (com.linkedin.thirdeye.dashboard.resources.CacheResource)2 AdminResource (com.linkedin.thirdeye.dashboard.resources.AdminResource)1 AnomalyFunctionResource (com.linkedin.thirdeye.dashboard.resources.AnomalyFunctionResource)1 AnomalyResource (com.linkedin.thirdeye.dashboard.resources.AnomalyResource)1 DashboardResource (com.linkedin.thirdeye.dashboard.resources.DashboardResource)1 DatasetConfigResource (com.linkedin.thirdeye.dashboard.resources.DatasetConfigResource)1 EmailResource (com.linkedin.thirdeye.dashboard.resources.EmailResource)1 EntityManagerResource (com.linkedin.thirdeye.dashboard.resources.EntityManagerResource)1 IngraphDashboardConfigResource (com.linkedin.thirdeye.dashboard.resources.IngraphDashboardConfigResource)1 IngraphMetricConfigResource (com.linkedin.thirdeye.dashboard.resources.IngraphMetricConfigResource)1 JobResource (com.linkedin.thirdeye.dashboard.resources.JobResource)1 MetricConfigResource (com.linkedin.thirdeye.dashboard.resources.MetricConfigResource)1 OnboardResource (com.linkedin.thirdeye.dashboard.resources.OnboardResource)1 OverrideConfigResource (com.linkedin.thirdeye.dashboard.resources.OverrideConfigResource)1 SummaryResource (com.linkedin.thirdeye.dashboard.resources.SummaryResource)1 ThirdEyeResource (com.linkedin.thirdeye.dashboard.resources.ThirdEyeResource)1 AnomaliesResource (com.linkedin.thirdeye.dashboard.resources.v2.AnomaliesResource)1 DataResource (com.linkedin.thirdeye.dashboard.resources.v2.DataResource)1 EventResource (com.linkedin.thirdeye.dashboard.resources.v2.EventResource)1 TimeSeriesResource (com.linkedin.thirdeye.dashboard.resources.v2.TimeSeriesResource)1