jihaozh commented on a change in pull request #3812: [TE] Refactor detection &
preview API for better debugging
URL: https://github.com/apache/incubator-pinot/pull/3812#discussion_r255645810
##########
File path:
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlResource.java
##########
@@ -260,37 +237,51 @@ public Response createYamlAlert(@ApiParam(value = "a
json contains both notific
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.TEXT_PLAIN)
@ApiOperation("Set up a detection pipeline using a YAML config")
- public Response setUpDetectionPipeline(
+ public Response createDetectionPipelineApi(
@ApiParam("yaml config") String payload,
@ApiParam("tuning window start time for tunable components")
@QueryParam("startTime") long startTime,
@ApiParam("tuning window end time for tunable components")
@QueryParam("endTime") long endTime) {
- if (StringUtils.isBlank(payload)){
- return
Response.status(Response.Status.BAD_REQUEST).entity(ImmutableMap.of("message",
"empty payload")).build();
- }
- Map<String, Object> yamlConfig;
+ Map<String, String> responseMessage = new HashMap<>();
+ long detectionConfigId;
try {
- yamlConfig = (Map<String, Object>) this.yaml.load(payload);
- } catch (Exception e){
- return
Response.status(Response.Status.BAD_REQUEST).entity(ImmutableMap.of("message",
"detection yaml parsing error, " + e.getMessage())).build();
+ detectionConfigId = createDetectionPipeline(payload, startTime, endTime);
+ } catch (ValidationException e) {
+ LOG.warn("Validation error while creating detection pipeline with
payload " + payload, e);
+ responseMessage.put("message", "Validation Error! " + e.getMessage());
+ return Response.serverError().entity(responseMessage).build();
+ } catch (Exception e) {
+ LOG.error("Error creating subscription group with payload " + payload,
e);
+ responseMessage.put("message", "Failed to create the subscription group.
Reach out to the ThirdEye team.");
Review comment:
Should be detection pipeline, not subscription group. And this error
checking logic is missing in the /create-alert endpoint.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]