xiaohui-sun commented on a change in pull request #4136: [TE] catch exceptions
in dimension exploration
URL: https://github.com/apache/incubator-pinot/pull/4136#discussion_r277433785
##########
File path:
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/algorithm/DimensionWrapper.java
##########
@@ -198,15 +199,36 @@ public DetectionPipelineResult run() throws Exception {
List<MergedAnomalyResultDTO> anomalies = new ArrayList<>();
Map<String, Object> diagnostics = new HashMap<>();
Set<Long> lastTimeStamps = new HashSet<>();
- LOG.info("exploring {} metrics", nestedMetrics.size());
- for (MetricEntity metric : nestedMetrics) {
- for (Map<String, Object> properties : this.nestedProperties) {
- LOG.info("running detection for {}", metric.toString());
- DetectionPipelineResult intermediate = this.runNested(metric,
properties);
- lastTimeStamps.add(intermediate.getLastTimestamp());
- anomalies.addAll(intermediate.getAnomalies());
- diagnostics.put(metric.getUrn(), intermediate.getDiagnostics());
+ long totalNestedMetrics = nestedMetrics.size();
+ long successCount = 0; // record the number of successfully explored
dimensions
+ LOG.info("exploring {} metrics", totalNestedMetrics);
+ for (int i = 0; i < totalNestedMetrics; i++) {
+ if (i == EARLY_STOP_THRESHOLD && successCount == 0) {
+ // if for the first certain number of dimensions all failed, throw the
exception
+ throw new RuntimeException(String.format(
+ "Detection failed for first %d out of %d metric dimensions for
monitoring window %d to %d, stop dimension explore.",
+ i, totalNestedMetrics, this.getStartTime(), this.getEndTime()));
}
+ MetricEntity metric = nestedMetrics.get(i);
+ try {
+ LOG.info("running detection for metric urn {}. {}/{}",
metric.getUrn(), i + 1, totalNestedMetrics);
+ for (Map<String, Object> properties : this.nestedProperties) {
+ DetectionPipelineResult intermediate = this.runNested(metric,
properties);
+ lastTimeStamps.add(intermediate.getLastTimestamp());
+ anomalies.addAll(intermediate.getAnomalies());
+ diagnostics.put(metric.getUrn(), intermediate.getDiagnostics());
+ }
+ } catch (Exception e) {
+ LOG.warn("[DetectionConfigID{}] detecting anomalies for window {} to
{} failed for metric urn {}.",
+ this.config.getId(), this.start, this.end, metric.getUrn(), e);
+ }
+ successCount++;
+ }
+
+ if (successCount == 0) {
Review comment:
successCount == 0 && totalNestedMetrics > 0
----------------------------------------------------------------
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]