vincentchenjl commented on a change in pull request #5962: URL: https://github.com/apache/incubator-pinot/pull/5962#discussion_r483806658
########## File path: thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DetectionResource.java ########## @@ -570,4 +574,19 @@ public Response getDetectionHealth(@PathParam("id") @ApiParam("detection config } return Response.ok(health).build(); } + + @POST + @Path(value = "/re-notify") + @ApiOperation("Resend the notification for the anomalies to the subscribed notification groups, if the subscription group supports re-notify") + public Response alert(@QueryParam("id") List<Long> anomalyIds) { + List<MergedAnomalyResultDTO> anomalies = this.anomalyDAO.findByIds(anomalyIds); + for (MergedAnomalyResultDTO anomaly : anomalies) { + AnomalySubscriptionGroupNotificationDTO anomalySubscriptionGroupNotificationDTO = + new AnomalySubscriptionGroupNotificationDTO(); + anomalySubscriptionGroupNotificationDTO.setAnomalyId(anomaly.getId()); + anomalySubscriptionGroupNotificationDTO.setDetectionConfigId(anomaly.getDetectionConfigId()); + anomalySubscriptionGroupNotificationManager.save(anomalySubscriptionGroupNotificationDTO); Review comment: Why are we not checking if the corresponding entry exists for the anomalies? ########## File path: thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DetectionPipelineTaskRunner.java ########## @@ -167,6 +175,14 @@ public DetectionPipelineTaskRunner(DetectionConfigManager detectionDAO, MergedAn } this.detectionDAO.update(config); + // re-notify the anomalies if any + for (MergedAnomalyResultDTO anomaly : result.getAnomalies()) { + // if an anomaly should be re-notified, update the notification lookup table in the database + if (anomaly.shouldRenotify()) { Review comment: Do we expect that new anomalies also have `renotify` flag as true? Or this should only apply for existing anomalies? ########## File path: thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/constant/AnomalySeverity.java ########## @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.pinot.thirdeye.constant; + +public enum AnomalySeverity { + LOW("low"), MODERATE("moderate"), HIGH("high"), CRITICAL("critical"), DEFAULT("default"); Review comment: There's a conflict here between this PR and mine. The labeler in the other PR relies on the order of the severity. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org