Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ private Map<String, Object> translateAnomalyFunctionToYaml(AnomalyFunctionDTO an
yamlConfigs.put("detectionName", anomalyFunctionDTO.getFunctionName());
yamlConfigs.put("description", "<Please edit and provide a description for this alert>");
yamlConfigs.put("metric", anomalyFunctionDTO.getMetric());
yamlConfigs.put("active", anomalyFunctionDTO.getIsActive());
yamlConfigs.put("dataset", anomalyFunctionDTO.getCollection());
yamlConfigs.put("pipelineType", "Composite");
if (StringUtils.isNotBlank(anomalyFunctionDTO.getExploreDimensions())) {
Expand Down Expand Up @@ -586,16 +587,15 @@ public Response migrateAnomalyFunction() throws Exception {
validateFunction(func);
} catch (ValidationException e) {
LOGGER.info("[MIG] Function failed validation. Name " + func.getFunctionName() + " Error : " + e.getMessage());
responseMessage.put("Failed to migrate " + func.getId(), String.format("Validation Error : %s", e.getMessage()));
continue;
}

try {
migrateLegacyAnomalyFunction(func);
} catch (Exception e) {
// Skip migrating this function and move on to the next
responseMessage.put("Status of function " + func.getId(),
String.format("Failed to migrate function ID %d with name %s due to %s", func.getId(),
func.getFunctionName(), e.getMessage()));
responseMessage.put("Failed to migrate " + func.getId(), String.format("Error : %s", e.getMessage()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ YamlTranslationResult translateYaml() {
List<Map<String, Object>> filterYamls = ConfigUtils.getList(ruleYaml.get(PROP_FILTER));
List<Map<String, Object>> detectionYamls = ConfigUtils.getList(ruleYaml.get(PROP_DETECTION));
List<Map<String, Object>> detectionProperties = buildListOfMergeWrapperProperties(detectionYamls);
if (filterYamls == null || filterYamls.isEmpty()) {
if (filterYamls.isEmpty()) {
nestedPipelines.addAll(detectionProperties);
} else {
List<Map<String, Object>> filterNestedProperties = detectionProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public DetectionConfigDTO generateDetectionConfig() {
config.setName(MapUtils.getString(yamlConfig, PROP_NAME));
config.setDescription(MapUtils.getString(yamlConfig, PROP_DESC_NAME));
config.setLastTimestamp(System.currentTimeMillis());
config.setActive(true);
YamlTranslationResult translationResult = translateYaml();
Preconditions.checkArgument(!translationResult.getProperties().isEmpty(), "Empty detection property");
config.setProperties(translationResult.getProperties());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
]
},
"active":true,
"yaml":"detectionName: test_function\ndescription: <Please edit and provide a description for this alert>\nmetric: test_metric\ndataset: test_collection\npipelineType: Composite\ndimensionExploration:\n dimensions:\n - platform\nfilters:\n platform:\n - desktop\n - tablet\nrules:\n- detection:\n - name: detection_rule1\n type: PERCENTAGE_RULE\n params:\n percentageChange: 0.05\n pattern: DOWN\n",
"yaml":"detectionName: test_function\ndescription: <Please edit and provide a description for this alert>\nmetric: test_metric\nactive: true\ndataset: test_collection\npipelineType: Composite\ndimensionExploration:\n dimensions:\n - platform\nfilters:\n platform:\n - desktop\n - tablet\nrules:\n- detection:\n - name: detection_rule1\n type: PERCENTAGE_RULE\n params:\n percentageChange: 0.05\n pattern: DOWN\n",
"componentSpecs":{
"detection_rule1:PERCENTAGE_RULE":{
"percentageChange":0.05,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
]
},
"active":true,
"yaml":"detectionName: test_function\ndescription: <Please edit and provide a description for this alert>\nmetric: test_metric\ndataset: test_collection\npipelineType: Composite\nfilters:\n score_challenge_type:\n - Captcha Challenge\nrules:\n- detection:\n - name: detection_rule1\n type: THRESHOLD\n params:\n min: '0.70'\n",
"yaml":"detectionName: test_function\ndescription: <Please edit and provide a description for this alert>\nmetric: test_metric\nactive: true\ndataset: test_collection\npipelineType: Composite\nfilters:\n score_challenge_type:\n - Captcha Challenge\nrules:\n- detection:\n - name: detection_rule1\n type: THRESHOLD\n params:\n min: '0.70'\n",
"componentSpecs":{
"detection_rule1:THRESHOLD":{
"min":"0.70",
Expand Down