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