This is an automated email from the ASF dual-hosted git repository. jihao pushed a commit to branch anomalies-pagination in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
commit b4e073314c403674437d6b6df4f0a4be00d84a64 Author: Jihao Zhang <jizh...@linkedin.com> AuthorDate: Wed Jul 29 16:11:52 2020 -0700 add java docs --- .../v2/anomalies/AnomalySearchFilter.java | 55 ++++++++++++++++++++++ .../v2/anomalies/AnomalySearchResource.java | 21 +++++++++ .../resources/v2/anomalies/AnomalySearcher.java | 11 ++++- 3 files changed, 85 insertions(+), 2 deletions(-) diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/anomalies/AnomalySearchFilter.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/anomalies/AnomalySearchFilter.java index fbc17e8..e995e5a 100644 --- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/anomalies/AnomalySearchFilter.java +++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/anomalies/AnomalySearchFilter.java @@ -3,6 +3,9 @@ package org.apache.pinot.thirdeye.dashboard.resources.v2.anomalies; import java.util.List; +/** + * The type Anomaly search filter. + */ public class AnomalySearchFilter { private final List<String> feedbacks; private final List<String> subscriptionGroups; @@ -13,6 +16,18 @@ public class AnomalySearchFilter { private final Long startTime; private final Long endTime; + /** + * Instantiates a new Anomaly search filter. + * + * @param startTime the start time + * @param endTime the end time + * @param feedbacks the feedbacks + * @param subscriptionGroups the subscription groups + * @param detectionNames the detection names + * @param metrics the metrics + * @param datasets the datasets + * @param anomalyIds the anomaly ids + */ public AnomalySearchFilter(Long startTime, Long endTime, List<String> feedbacks, List<String> subscriptionGroups, List<String> detectionNames, List<String> metrics, List<String> datasets, List<Long> anomalyIds) { this.feedbacks = feedbacks; @@ -25,34 +40,74 @@ public class AnomalySearchFilter { this.anomalyIds = anomalyIds; } + /** + * Gets start time. + * + * @return the start time + */ public Long getStartTime() { return startTime; } + /** + * Gets end time. + * + * @return the end time + */ public Long getEndTime() { return endTime; } + /** + * Gets feedbacks. + * + * @return the feedbacks + */ public List<String> getFeedbacks() { return feedbacks; } + /** + * Gets subscription groups. + * + * @return the subscription groups + */ public List<String> getSubscriptionGroups() { return subscriptionGroups; } + /** + * Gets detection names. + * + * @return the detection names + */ public List<String> getDetectionNames() { return detectionNames; } + /** + * Gets metrics. + * + * @return the metrics + */ public List<String> getMetrics() { return metrics; } + /** + * Gets datasets. + * + * @return the datasets + */ public List<String> getDatasets() { return datasets; } + /** + * Gets anomaly ids. + * + * @return the anomaly ids + */ public List<Long> getAnomalyIds() { return anomalyIds; } diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/anomalies/AnomalySearchResource.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/anomalies/AnomalySearchResource.java index 74772a6..81b51a9 100644 --- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/anomalies/AnomalySearchResource.java +++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/anomalies/AnomalySearchResource.java @@ -13,6 +13,9 @@ import javax.ws.rs.core.Response; import org.apache.pinot.thirdeye.api.Constants; +/** + * The type Anomaly search resource. + */ @Path(value = "/anomaly-search") @Produces(MediaType.APPLICATION_JSON) @Api(tags = {Constants.DETECTION_TAG}) @@ -20,10 +23,28 @@ public class AnomalySearchResource { private final AnomalySearcher anomalySearcher; + /** + * Instantiates a new Anomaly search resource. + */ public AnomalySearchResource() { this.anomalySearcher = new AnomalySearcher(); } + /** + * Search and paginate the anomalies according to the parameters. + * + * @param limit the limit + * @param offset the offset + * @param startTime the start time + * @param endTime the end time + * @param feedbacks the feedback types, e.g. ANOMALY, NOT_ANOMALY + * @param subscriptionGroups the subscription groups + * @param detectionNames the detection names + * @param metrics the metrics + * @param datasets the datasets + * @param anomalyIds the anomaly ids + * @return the response + */ @GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation("Search and paginate anomalies according to the parameters") diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/anomalies/AnomalySearcher.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/anomalies/AnomalySearcher.java index bc29228..463cbe3 100644 --- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/anomalies/AnomalySearcher.java +++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/anomalies/AnomalySearcher.java @@ -23,11 +23,17 @@ import org.apache.pinot.thirdeye.datasource.DAORegistry; import static org.apache.pinot.thirdeye.constant.AnomalyFeedbackType.*; +/** + * The type Anomaly searcher. + */ public class AnomalySearcher { private final MergedAnomalyResultManager anomalyDAO; private final DetectionConfigManager detectionConfigDAO; private final DetectionAlertConfigManager detectionAlertConfigDAO; + /** + * Instantiates a new Anomaly searcher. + */ public AnomalySearcher() { this.anomalyDAO = DAORegistry.getInstance().getMergedAnomalyResultDAO(); this.detectionConfigDAO = DAORegistry.getInstance().getDetectionConfigManager(); @@ -108,9 +114,10 @@ public class AnomalySearcher { .sorted(Comparator.reverseOrder()) .collect(Collectors.toList()); count = anomalyIds.size(); - results = anomalyIds.isEmpty() ? Collections.emptyList() : this.anomalyDAO.findByIds(paginateResults(anomalyIds, offset, limit)); + results = anomalyIds.isEmpty() ? Collections.emptyList() + : this.anomalyDAO.findByIds(paginateResults(anomalyIds, offset, limit)); } else { - // filter by feedback types + // filter by feedback types if requested List<MergedAnomalyResultDTO> anomalies = this.anomalyDAO.findByPredicate(predicate); Set<AnomalyFeedbackType> feedbackFilters = searchFilter.getFeedbacks().stream().map(AnomalyFeedbackType::valueOf).collect(Collectors.toSet()); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org