You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/05/14 20:04:25 UTC

[GitHub] [incubator-pinot] jihaozh commented on a change in pull request #5386: [TE] Add support for configuring additional custom fields in Jira Alert

jihaozh commented on a change in pull request #5386:
URL: https://github.com/apache/incubator-pinot/pull/5386#discussion_r425398112



##########
File path: thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlResource.java
##########
@@ -1107,4 +1115,33 @@ public Response listYamls(
     LOG.info("Successfully returned " + yamls.size() + " detection configs.");
     return Response.ok(yamls).build();
   }
+
+  /**
+   * Api to trigger a notification alert. Mostly used for ad-hoc testing.
+   * Alert will be sent only if there are new anomalies since the last watermark.
+   * Watermarks will be updated after notifying anomalies if any.
+   */
+  @PUT
+  @Path("/notify/{id}")
+  @ApiOperation("Send notification email for detection alert config")
+  public void test(
+      @ApiParam("Subscription configuration id for the alert") @NotNull @PathParam("id") long detectionAlertConfigId) {
+    LOG.info("Triggering subscription task with id " + detectionAlertConfigId);
+
+    // Build the task context
+    ThirdEyeAnomalyConfiguration config = new ThirdEyeAnomalyConfiguration();
+    config.setAlerterConfiguration(alerterConfig);
+    TaskContext taskContext = new TaskContext();
+    taskContext.setThirdEyeAnomalyConfiguration(config);
+
+    // Run the notification task. This will update the subscription watermark as well.
+    DetectionAlertTaskInfo taskInfo = new DetectionAlertTaskInfo(detectionAlertConfigId);
+    TaskRunner taskRunner = new DetectionAlertTaskRunner();
+    try {
+      taskRunner.execute(taskInfo, taskContext);
+    } catch (Exception e) {
+      LOG.error("Exception while triggering the notification task with id " + detectionAlertConfigId, e);

Review comment:
       return the error message in the endpoint's response?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org