jihaozh commented on a change in pull request #4140: [TE] Update TE-Raptor API
to support multiple metrics
URL: https://github.com/apache/incubator-pinot/pull/4140#discussion_r276889622
##########
File path:
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/api/user/dashboard/UserDashboardResource.java
##########
@@ -242,6 +258,35 @@ public UserDashboardResource(MergedAnomalyResultManager
anomalyDAO, MetricConfig
return output;
}
+ private Collection<MergedAnomalyResultDTO>
fetchAnomaliesByMetricDatasetPairs(Long start, Long end, String metricsRef) {
+ List<MergedAnomalyResultDTO> anomalies = new ArrayList<>();
+
+ if (StringUtils.isBlank(metricsRef)) {
+ return Collections.emptyList();
+ }
+
+ List<Predicate> predicates = new ArrayList<>();
+ predicates.add(Predicate.GE("endTime", start));
+ if (end != null) {
+ predicates.add(Predicate.LT("startTime", end));
+ }
+
+ String[] metricDatasetPairs = metricsRef.split(",");
+ for (String metricDatasetPair : metricDatasetPairs) {
+ List<Predicate> metricDatasetPred = new ArrayList<>(predicates);
Review comment:
can put the parsing logic into a factory method of the static inner class
and JAX-RS will handle this automatically. For example
`
private static class MetricDatasetPair {
String metricName;
String datasetName;
public static MetricDatasetPair fromString(String input){
// parse the input strting and initilize the object
}
}
`
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]