vincentchenjl commented on a change in pull request #4988: [TE] Support weekly
anomaly detection
URL: https://github.com/apache/incubator-pinot/pull/4988#discussion_r367619494
##########
File path:
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/components/PercentageChangeRuleDetector.java
##########
@@ -76,16 +80,34 @@
@Override
public DetectionResult runDetection(Interval window, String metricUrn) {
+ long startMillis = window.getStartMillis();
+
+ // align start day to the user specified week start
+ if (Objects.nonNull(this.weekStart)) {
+ startMillis =
window.getStart().withDayOfWeek(weekStart.getValue()).minusWeeks(1).getMillis();
+ }
+
MetricEntity me = MetricEntity.fromURN(metricUrn);
- MetricSlice slice = MetricSlice.from(me.getId(), window.getStartMillis(),
window.getEndMillis(), me.getFilters(), timeGranularity);
+ MetricSlice slice = MetricSlice.from(me.getId(), startMillis,
window.getEndMillis(), me.getFilters(), timeGranularity);
List<MetricSlice> slices = new ArrayList<>(this.baseline.scatter(slice));
slices.add(slice);
InputData data = this.dataFetcher.fetchData(new
InputDataSpec().withTimeseriesSlices(slices)
.withMetricIdsForDataset(Collections.singletonList(slice.getMetricId())));
- DataFrame dfCurr = data.getTimeseries().get(slice).renameSeries(COL_VALUE,
COL_CURR);
DataFrame dfBase = this.baseline.gather(slice, data.getTimeseries());
+ DataFrame dfCurr = data.getTimeseries().get(slice);
+ DatasetConfigDTO datasetConfig =
data.getDatasetForMetricId().get(me.getId());
+ // aggregate data to specified weekly granularity
+ if (this.monitoringGranularity.endsWith("WEEKS")) {
Review comment:
Sure. Thanks.
----------------------------------------------------------------
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]