Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
Signed-off-by: Kaituo Li <[email protected]>
  • Loading branch information
kaituo committed Sep 12, 2024
1 parent d44737e commit 88e88ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/main/java/org/opensearch/ad/model/AnomalyResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public class AnomalyResult extends IndexableResult {
pastValues is related to relativeIndex, startOfAnomaly and anomaly grade.
So if we detect anomaly late, we get the baseDimension values from the past (current is 0).
That is, we look back relativeIndex * baseDimensions.
For example, current shingle is
"currentValues": [
6819.0,
Expand Down Expand Up @@ -145,10 +145,10 @@ So if we detect anomaly late, we get the baseDimension values from the past (cur
86376.0,
64878.0
],
So pastValues is null when relativeIndex is 0 or startOfAnomaly is true
or the current shingle is not an anomaly.
In the UX, if pastValues value is null, we can just show attribution/expected
value and it is implicit this is due to current input; if pastValues is not
null, it means the the attribution/expected values are from an old value
Expand Down Expand Up @@ -446,7 +446,7 @@ public static AnomalyResult fromRawTRCFResult(
taskId,
rcfScore,
Math.max(0, grade),
confidence,
Math.min(1, confidence),
featureData,
dataStartTime,
dataEndTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public static List<ForecastResult> fromRawRCFCasterResult(
new ForecastResult(
forecasterId,
taskId,
dataQuality,
Math.min(1, dataQuality),
featureData,
dataStartTime,
dataEndTime,
Expand Down Expand Up @@ -218,7 +218,7 @@ public static List<ForecastResult> fromRawRCFCasterResult(
new ForecastResult(
forecasterId,
taskId,
dataQuality,
Math.min(1, dataQuality),
null,
dataStartTime,
dataEndTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ public void onResponse(CompositeRetriever.Page entityFeatures) {
pageIterator.next(this);
}
if (entityFeatures != null && false == entityFeatures.isEmpty()) {
sentOutPages.incrementAndGet();

LOG
.info(
"Sending an HC request to process data from timestamp {} to {} for config {}",
Expand Down Expand Up @@ -285,6 +283,7 @@ public void onResponse(CompositeRetriever.Page entityFeatures) {
final AtomicReference<Exception> failure = new AtomicReference<>();

node2Entities.stream().forEach(nodeEntity -> {
sentOutPages.incrementAndGet();
DiscoveryNode node = nodeEntity.getKey();
transportService
.sendRequest(
Expand Down Expand Up @@ -370,7 +369,7 @@ public void run() {
cancellable.get().cancel();
}
} else if (Instant.now().toEpochMilli() >= timeoutMillis) {
LOG.warn("Scheduled impute HC task is cancelled due to timeout");
LOG.warn("Scheduled impute HC task is cancelled due to timeout, current epoch {}, timeout epoch {}, dataEndTime {}, sent out {}, receive {}", Instant.now().toEpochMilli(), timeoutMillis, dataEndTime, sentOutPages.get(), receivedPages.get());
if (cancellable != null) {
cancellable.get().cancel();
}
Expand Down

0 comments on commit 88e88ef

Please sign in to comment.