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 2f691fc [TE] detection health - coverage fix (#4428)
2f691fc is described below
commit 2f691fc761c8dba517df07248024b1ff633f539a
Author: Jihao Zhang <[email protected]>
AuthorDate: Fri Jul 12 10:18:20 2019 -0700
[TE] detection health - coverage fix (#4428)
Fix the issue that anomaly coverage can be more than 100%
Update the logic to get the latest success task to finish time in backend
---
.../app/pods/components/detection-health/component.js | 8 ++++----
.../app/pods/components/detection-health/template.hbs | 2 +-
.../pinot/thirdeye/detection/health/DetectionHealth.java | 4 ++--
.../thirdeye/detection/health/DetectionTaskStatus.java | 14 ++++++++++++++
4 files changed, 21 insertions(+), 7 deletions(-)
diff --git
a/thirdeye/thirdeye-frontend/app/pods/components/detection-health/component.js
b/thirdeye/thirdeye-frontend/app/pods/components/detection-health/component.js
index 9af2ae0..4014e4d 100644
---
a/thirdeye/thirdeye-frontend/app/pods/components/detection-health/component.js
+++
b/thirdeye/thirdeye-frontend/app/pods/components/detection-health/component.js
@@ -112,10 +112,10 @@ export default Component.extend({
executionTime: computed(
'health',
function() {
- const health = get(this, 'health');
- if (health.detectionTaskStatus.tasks.length != 0) {
- const lastExecutionTime = new
Date(health.detectionTaskStatus.tasks[0].endTime);
- return lastExecutionTime.toDateString() + ", " +
lastExecutionTime.toLocaleTimeString() + " (" +
moment().tz(moment.tz.guess()).format('z') + ")"
+ const lastTaskExecutionTimestamp = get(this,
'health').detectionTaskStatus.lastTaskExecutionTime;
+ if (lastTaskExecutionTimestamp > 0) {
+ const executionDateTime = new Date(lastTaskExecutionTimestamp);
+ return executionDateTime.toDateString() + ", " +
executionDateTime.toLocaleTimeString() + " (" +
moment().tz(moment.tz.guess()).format('z') + ")"
}
return "-"
}
diff --git
a/thirdeye/thirdeye-frontend/app/pods/components/detection-health/template.hbs
b/thirdeye/thirdeye-frontend/app/pods/components/detection-health/template.hbs
index f2d2f3c..c14532a 100644
---
a/thirdeye/thirdeye-frontend/app/pods/components/detection-health/template.hbs
+++
b/thirdeye/thirdeye-frontend/app/pods/components/detection-health/template.hbs
@@ -26,7 +26,7 @@
<div class="te-horizontal-metrics__container">
<ul class="te-horizontal-metrics__metric">
<li class="te-horizontal-metrics__number">{{executionTime}}</li>
- <li class="te-horizontal-metrics__title">Last Detection Task Finish
Time</li>
+ <li class="te-horizontal-metrics__title">Last success detection task
finish time</li>
</ul>
</div>
diff --git
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/health/DetectionHealth.java
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/health/DetectionHealth.java
index 347d6c5..8ad98c2 100644
---
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/health/DetectionHealth.java
+++
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/health/DetectionHealth.java
@@ -201,7 +201,7 @@ public class DetectionHealth {
List<Interval> intervals = new ArrayList<>();
if (!anomalies.isEmpty()) {
anomalies.sort(Comparator.comparingLong(MergedAnomalyResultBean::getStartTime));
- long start = anomalies.stream().findFirst().get().getStartTime();
+ long start =
Math.max(anomalies.stream().findFirst().get().getStartTime(), this.startTime);
long end = anomalies.stream().findFirst().get().getEndTime();
for (MergedAnomalyResultDTO anomaly : anomalies) {
if (anomaly.getStartTime() <= end) {
@@ -212,7 +212,7 @@ public class DetectionHealth {
end = anomaly.getEndTime();
}
}
- intervals.add(new Interval(start, end));
+ intervals.add(new Interval(start, Math.min(end, this.endTime)));
}
// compute coverage
diff --git
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/health/DetectionTaskStatus.java
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/health/DetectionTaskStatus.java
index 84acc6b..4c9c3fb 100644
---
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/health/DetectionTaskStatus.java
+++
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/health/DetectionTaskStatus.java
@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
+import javafx.concurrent.Task;
import org.apache.pinot.thirdeye.anomaly.task.TaskConstants;
import org.apache.pinot.thirdeye.datalayer.dto.TaskDTO;
import org.apache.pinot.thirdeye.datalayer.pojo.TaskBean;
@@ -42,6 +43,14 @@ public class DetectionTaskStatus {
@JsonProperty
private final HealthStatus healthStatus;
+ // the time stamp of last successfully finishing task
+ @JsonProperty
+ private final Long lastTaskExecutionTime;
+
+ public Long getLastTaskExecutionTime() {
+ return lastTaskExecutionTime;
+ }
+
// the counting for detection task status
@JsonProperty
private final Map<TaskConstants.TaskStatus, Long> taskCounts = new
HashMap<TaskConstants.TaskStatus, Long>() {{
@@ -63,6 +72,11 @@ public class DetectionTaskStatus {
this.healthStatus = healthStatus;
this.tasks = tasks;
this.taskCounts.putAll(counts);
+ this.lastTaskExecutionTime = tasks.stream()
+ .filter(task ->
task.getStatus().equals(TaskConstants.TaskStatus.COMPLETED))
+ .map(TaskBean::getEndTime)
+ .findFirst()
+ .orElse(-1L);
}
public double getTaskSuccessRate() {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]