You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ap...@apache.org on 2018/12/14 00:33:26 UTC

[incubator-pinot] branch master updated: [TE] subscription groups endpoint (#3616)

This is an automated email from the ASF dual-hosted git repository.

apucher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new f079714  [TE] subscription groups endpoint (#3616)
f079714 is described below

commit f079714c3ffa1246f38dc6b83e15e29e15a28bb8
Author: Jihao Zhang <ji...@linkedin.com>
AuthorDate: Thu Dec 13 16:33:21 2018 -0800

    [TE] subscription groups endpoint (#3616)
---
 .../linkedin/thirdeye/detection/DetectionResource.java   | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/DetectionResource.java b/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/DetectionResource.java
index 2647e9f..9a6376a 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/DetectionResource.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/DetectionResource.java
@@ -46,9 +46,11 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
+import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import javax.ws.rs.DefaultValue;
 import javax.ws.rs.GET;
@@ -122,6 +124,20 @@ public class DetectionResource {
     return Response.ok(config).build();
   }
 
+  @Path("/subscription-groups/{id}")
+  @GET
+  @ApiOperation("get a list of detection alert configs for a given detection config id")
+  public Response getSubscriptionGroups(@ApiParam("the detection config id") @PathParam("id") long id){
+    List<DetectionAlertConfigDTO> detectionAlertConfigDTOs = this.detectionAlertConfigDAO.findAll();
+    Set<DetectionAlertConfigDTO> subscriptionGroupAlertDTOs = new HashSet<>();
+    for (DetectionAlertConfigDTO alertConfigDTO : detectionAlertConfigDTOs){
+      if (alertConfigDTO.getVectorClocks().containsKey(id)){
+        subscriptionGroupAlertDTOs.add(alertConfigDTO);
+      }
+    }
+    return Response.ok(new ArrayList<>(subscriptionGroupAlertDTOs)).build();
+  }
+
   @POST
   @Path("/preview")
   public Response detectionPreview(


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