You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ji...@apache.org on 2019/03/08 19:56:45 UTC

[incubator-pinot] branch master updated: [TE] detection - hide child anomalies in anomalies endpoint (#3940)

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

jihao 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 5d7612d  [TE] detection - hide child anomalies in anomalies endpoint (#3940)
5d7612d is described below

commit 5d7612d3133b401ff4d9cce70884b28fb1379283
Author: Jihao Zhang <ji...@linkedin.com>
AuthorDate: Fri Mar 8 11:56:40 2019 -0800

    [TE] detection - hide child anomalies in anomalies endpoint (#3940)
---
 .../pinot/thirdeye/api/user/dashboard/UserDashboardResource.java      | 4 +++-
 .../java/org/apache/pinot/thirdeye/detection/DetectionResource.java   | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/api/user/dashboard/UserDashboardResource.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/api/user/dashboard/UserDashboardResource.java
index bbf2e9e..871f34a 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/api/user/dashboard/UserDashboardResource.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/api/user/dashboard/UserDashboardResource.java
@@ -35,6 +35,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
+import java.util.stream.Collectors;
 import javax.annotation.Nullable;
 import javax.ws.rs.DefaultValue;
 import javax.ws.rs.GET;
@@ -213,7 +214,8 @@ public class UserDashboardResource {
       }
       anomalies = trueAnomalies;
     }
-
+    // filter child anomalies
+    anomalies = anomalies.stream().filter(anomaly -> !anomaly.isChild()).collect(Collectors.toList());
     // limit result size
     anomalies = anomalies.subList(0, Math.min(anomalies.size(), limit));
 
diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DetectionResource.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DetectionResource.java
index 209cc8a..0b3146a 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DetectionResource.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DetectionResource.java
@@ -167,7 +167,7 @@ public class DetectionResource {
             Predicate.EQ("detectionConfigId", detectionConfigId),
             Predicate.LT("startTime", endTime),
             Predicate.GT("endTime", startTime)));
-    List result = anomalies.stream().map(anomaly -> {
+    List result = anomalies.stream().filter(anomaly -> !anomaly.isChild()).map(anomaly -> {
       Map<String, Object> anomalyResult = OBJECT_MAPPER.convertValue(anomaly, Map.class);
       anomalyResult.put(AnomalyEventFormatter.ATTR_STATUS_CLASSIFICATION, ResourceUtils.getStatusClassification(anomaly).toString());
       return anomalyResult;


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