use of com.linkedin.thirdeye.datalayer.dto.AnomalyFunctionDTO in project pinot by linkedin.
the class TestEmailConfigurationManager method testDelete.
@Test(dependsOnMethods = { "testFindByFunctionId" })
public void testDelete() {
emailConfigurationDAO.deleteById(emailConfigId);
EmailConfigurationDTO emailConfiguration = emailConfigurationDAO.findById(emailConfigId);
AnomalyFunctionDTO anomalyFunctionSpec = anomalyFunctionDAO.findById(functionId);
// email configuration should be deleted and anomaly function should not.
assertNull(emailConfiguration);
assertNotNull(anomalyFunctionSpec);
// now cleanup the anomaly function
anomalyFunctionDAO.deleteById(anomalyFunctionSpec.getId());
}
use of com.linkedin.thirdeye.datalayer.dto.AnomalyFunctionDTO in project pinot by linkedin.
the class CleanupAndRegenerateAnomaliesTool method regenerateAnomaliesForBucketsInRange.
/**
* Breaks down the given range into consecutive monitoring windows as per function definition
* Regenerates anomalies for each window separately
* @throws Exception
*/
private void regenerateAnomaliesForBucketsInRange(boolean forceBackfill) throws Exception {
for (Long functionId : functionIds) {
AnomalyFunctionDTO anomalyFunction = anomalyFunctionDAO.findById(functionId);
if (!anomalyFunction.getIsActive()) {
LOG.info("Skipping deactivated function {}", functionId);
continue;
}
LOG.info("Sending backfill function {} for range {} to {}", functionId, monitoringWindowStartTime, monitoringWindowEndTime);
String response = detectionResourceHttpUtils.runBackfillAnomalyFunction(String.valueOf(functionId), monitoringWindowStartTime, monitoringWindowEndTime, forceBackfill);
LOG.info("Response {}", response);
}
}
use of com.linkedin.thirdeye.datalayer.dto.AnomalyFunctionDTO in project pinot by linkedin.
the class CleanupAndRegenerateAnomaliesTool method regenerateAnomaliesInRange.
/**
* Regenerates anomalies for the whole given range as one monitoring window
* @throws Exception
*/
@Deprecated
private void regenerateAnomaliesInRange() throws Exception {
LOG.info("Begin regenerate anomalies for entire range...");
for (Long functionId : functionIds) {
AnomalyFunctionDTO anomalyFunction = anomalyFunctionDAO.findById(functionId);
boolean isActive = anomalyFunction.getIsActive();
if (!isActive) {
LOG.info("Skipping function {}", functionId);
continue;
}
runAdhocFunctionForWindow(functionId, monitoringWindowStartTime, monitoringWindowEndTime);
}
}
use of com.linkedin.thirdeye.datalayer.dto.AnomalyFunctionDTO in project pinot by linkedin.
the class AbstractManagerTestBase method getTestFunctionSpec.
protected AnomalyFunctionDTO getTestFunctionSpec(String metricName, String collection) {
AnomalyFunctionDTO functionSpec = new AnomalyFunctionDTO();
functionSpec.setFunctionName("integration test function 1");
functionSpec.setType("WEEK_OVER_WEEK_RULE");
functionSpec.setTopicMetric(metricName);
functionSpec.setMetrics(Arrays.asList(metricName));
functionSpec.setCollection(collection);
functionSpec.setMetricFunction(MetricAggFunction.SUM);
functionSpec.setCron("0/10 * * * * ?");
functionSpec.setBucketSize(1);
functionSpec.setBucketUnit(TimeUnit.HOURS);
functionSpec.setWindowDelay(3);
functionSpec.setWindowDelayUnit(TimeUnit.HOURS);
functionSpec.setWindowSize(1);
functionSpec.setWindowUnit(TimeUnit.DAYS);
functionSpec.setProperties("baseline=w/w;changeThreshold=0.001");
functionSpec.setIsActive(true);
return functionSpec;
}
use of com.linkedin.thirdeye.datalayer.dto.AnomalyFunctionDTO in project pinot by linkedin.
the class AbstractManagerTestBase method getTestFunctionAlphaBetaAlertFilterSpec.
protected AnomalyFunctionDTO getTestFunctionAlphaBetaAlertFilterSpec(String metricName, String collection) {
AnomalyFunctionDTO functionSpec = getTestFunctionSpec(metricName, collection);
Map<String, String> alphaBetaAlertFilter = new HashMap<>();
alphaBetaAlertFilter.put("type", "alpha_beta");
alphaBetaAlertFilter.put(AlphaBetaAlertFilter.ALPHA, "1");
alphaBetaAlertFilter.put(AlphaBetaAlertFilter.BETA, "1");
alphaBetaAlertFilter.put(AlphaBetaAlertFilter.THRESHOLD, "0.5");
functionSpec.setAlertFilter(alphaBetaAlertFilter);
return functionSpec;
}
Aggregations