Search in sources :

Example 1 with OnboardResource

use of com.linkedin.thirdeye.dashboard.resources.OnboardResource 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 OnboardResource

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

the class CleanupAndRegenerateAnomaliesTool method deleteExistingAnomalies.

/**
   * Delete raw or merged anomalies whose start time is located in the given time ranges, except
   * the following two cases:
   *
   * 1. If a raw anomaly belongs to a merged anomaly whose start time is not located in the given
   * time ranges, then the raw anomaly will not be deleted.
   *
   * 2. If a raw anomaly belongs to a merged anomaly whose start time is located in the given
   * time ranges, then it is deleted regardless its start time.
   *
   * If monitoringWindowStartTime is not given, then start time is set to 0.
   * If monitoringWindowEndTime is not given, then end time is set to Long.MAX_VALUE.
   */
private void deleteExistingAnomalies() {
    long startTime = 0;
    long endTime = Long.MAX_VALUE;
    if (StringUtils.isNotBlank(monitoringWindowStartTime)) {
        startTime = ISODateTimeFormat.dateTimeParser().parseDateTime(monitoringWindowStartTime).getMillis();
    }
    if (StringUtils.isNotBlank(monitoringWindowEndTime)) {
        endTime = ISODateTimeFormat.dateTimeParser().parseDateTime(monitoringWindowEndTime).getMillis();
    }
    LOG.info("Deleting anomalies in the time range: {} -- {}", new DateTime(startTime), new DateTime(endTime));
    for (Long functionId : functionIds) {
        AnomalyFunctionDTO anomalyFunction = anomalyFunctionDAO.findById(functionId);
        if (anomalyFunction == null) {
            LOG.info("Requested functionId {} doesn't exist", functionId);
            continue;
        }
        LOG.info("Beginning cleanup of functionId {} collection {} metric {}", functionId, anomalyFunction.getCollection(), anomalyFunction.getMetric());
        // Clean up merged and raw anomaly of functionID
        OnboardResource onboardResource = new OnboardResource(anomalyFunctionDAO, mergedResultDAO, rawResultDAO);
        onboardResource.deleteExistingAnomalies(Long.toString(functionId), startTime, endTime);
    }
}
Also used : OnboardResource(com.linkedin.thirdeye.dashboard.resources.OnboardResource) AnomalyFunctionDTO(com.linkedin.thirdeye.datalayer.dto.AnomalyFunctionDTO) DateTime(org.joda.time.DateTime)

Aggregations

OnboardResource (com.linkedin.thirdeye.dashboard.resources.OnboardResource)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 CacheResource (com.linkedin.thirdeye.dashboard.resources.CacheResource)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 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