Skip to content

Commit

Permalink
synced with master
Browse files Browse the repository at this point in the history
  • Loading branch information
nalin-patidar committed Feb 4, 2025
2 parents 541c29c + 64da9bb commit 7912cee
Show file tree
Hide file tree
Showing 87 changed files with 4,563 additions and 75 deletions.
2 changes: 1 addition & 1 deletion jacoco-code-coverage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye</artifactId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>

<artifactId>jacoco-code-coverage</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pinot-test-container/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>thirdeye</artifactId>
<groupId>ai.startree.thirdeye</groupId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye</artifactId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>thirdeye</name>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye</artifactId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>

<artifactId>thirdeye-benchmarks</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion thirdeye-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye</artifactId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<artifactId>thirdeye-core</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-dataframe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye</artifactId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion thirdeye-detectionpipeline/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye</artifactId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<artifactId>thirdeye-detectionpipeline</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>thirdeye</artifactId>
<groupId>ai.startree.thirdeye</groupId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>thirdeye</artifactId>
<groupId>ai.startree.thirdeye</groupId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-notification/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye</artifactId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<artifactId>thirdeye-notification</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-persistence/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>thirdeye</artifactId>
<groupId>ai.startree.thirdeye</groupId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>thirdeye</artifactId>
<groupId>ai.startree.thirdeye</groupId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-plugins/thirdeye-bootstrap-open-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>thirdeye-plugins</artifactId>
<groupId>ai.startree.thirdeye.plugins</groupId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-plugins/thirdeye-contributors-simple/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>thirdeye-plugins</artifactId>
<groupId>ai.startree.thirdeye.plugins</groupId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-plugins/thirdeye-detectors/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>thirdeye-plugins</artifactId>
<groupId>ai.startree.thirdeye.plugins</groupId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,22 @@ private BooleanSeries valueTooHigh(DoubleSeries values) {
if (Double.isNaN(spec.getMax())) {
return BooleanSeries.fillValues(values.size(), false);
}
return values.gt(spec.getMax());
if (spec.isMaxInclusive()) {
return values.gt(spec.getMax());
} else {
return values.gte(spec.getMax());
}
}

private BooleanSeries valueTooLow(DoubleSeries values) {
if (Double.isNaN(spec.getMin())) {
return BooleanSeries.fillValues(values.size(), false);
}
return values.lt(spec.getMin());
if (spec.isMinInclusive()) {
return values.lt(spec.getMin());
} else {
return values.lte(spec.getMin());
}
}

private AnomalyDetectorResult runDetectionOnSingleDataTable(final DataFrame inputDf,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public class ThresholdRuleDetectorSpec extends AbstractSpec {

private double min = Double.NaN;
private double max = Double.NaN;

private boolean maxInclusive = true;

private boolean minInclusive = true;

public double getMin() {
return min;
Expand All @@ -39,4 +43,22 @@ public ThresholdRuleDetectorSpec setMax(final double max) {
this.max = max;
return this;
}

public boolean isMaxInclusive() {
return maxInclusive;
}

public ThresholdRuleDetectorSpec setMaxInclusive(final boolean maxInclusive) {
this.maxInclusive = maxInclusive;
return this;
}

public boolean isMinInclusive() {
return minInclusive;
}

public ThresholdRuleDetectorSpec setMinInclusive(final boolean minInclusive) {
this.minInclusive = minInclusive;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class ThresholdRuleDetectorTest {
private static final long JANUARY_3_2021 = 1609632000000L;
private static final long JANUARY_4_2021 = 1609718400000L;
private static final long JANUARY_5_2021 = 1609804800000L;
private static final long JANUARY_6_2021 = 1609891200000L;

@Test
public void testNoAnomalies() {
Expand Down Expand Up @@ -129,22 +130,24 @@ public void testDetectionRunsOnIntervalOnly() {
public void testAnomaliesUpAndDown() {
Interval interval = new Interval(JANUARY_1_2021, JANUARY_5_2021, DateTimeZone.UTC);
Map<String, DataTable> timeSeriesMap = new HashMap<>();
double minValue = 150;
double maxValue = 350.;
DataFrame currentDf = new DataFrame()
.addSeries(Constants.COL_TIME,
JANUARY_1_2021,
JANUARY_2_2021,
JANUARY_3_2021,
JANUARY_4_2021,
JANUARY_5_2021)
.addSeries(Constants.COL_VALUE, 100., 200., 300., 400., 500.);
JANUARY_5_2021,
JANUARY_6_2021)
.addSeries(Constants.COL_VALUE, 100., minValue, 200., 300., maxValue, 500.);
timeSeriesMap.put(AnomalyDetector.KEY_CURRENT, SimpleDataTable.fromDataFrame(currentDf));

ThresholdRuleDetectorSpec spec = new ThresholdRuleDetectorSpec();
spec.setMonitoringGranularity("P1D");
double minValue = 150;
double maxValue = 350.;
spec.setMin(minValue);
spec.setMax(maxValue);
spec.setMaxInclusive(false);
ThresholdRuleDetector detector = new ThresholdRuleDetector();
detector.init(spec);

Expand All @@ -153,6 +156,7 @@ public void testAnomaliesUpAndDown() {

DoubleSeries outputValueSeries = outputDf.getDoubles(Constants.COL_VALUE);
DoubleSeries expectedValueSeries = DoubleSeries.buildFrom(
minValue,
minValue,
200,
300,
Expand All @@ -163,9 +167,10 @@ public void testAnomaliesUpAndDown() {
BooleanSeries outputAnomalySeries = outputDf.getBooleans(Constants.COL_ANOMALY);
BooleanSeries expectedAnomalySeries = BooleanSeries.buildFrom(
BooleanSeries.TRUE,
BooleanSeries.FALSE, // not an anomaly because equal to minValue and default is to be inclusive of the min
BooleanSeries.FALSE,
BooleanSeries.FALSE,
BooleanSeries.TRUE,
BooleanSeries.TRUE, // anomaly because equal to maxValue and maxInclusive is set to false
BooleanSeries.TRUE);
assertThat(outputAnomalySeries).isEqualTo(expectedAnomalySeries);
}
Expand Down
2 changes: 1 addition & 1 deletion thirdeye-plugins/thirdeye-enumerators/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>thirdeye-plugins</artifactId>
<groupId>ai.startree.thirdeye.plugins</groupId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-plugins/thirdeye-notification-email/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>thirdeye-plugins</artifactId>
<groupId>ai.startree.thirdeye.plugins</groupId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-plugins/thirdeye-oauth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>thirdeye-plugins</artifactId>
<groupId>ai.startree.thirdeye.plugins</groupId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-plugins/thirdeye-pinot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>thirdeye-plugins</artifactId>
<groupId>ai.startree.thirdeye.plugins</groupId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion thirdeye-plugins/thirdeye-plugin-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>thirdeye-plugins</artifactId>
<groupId>ai.startree.thirdeye.plugins</groupId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion thirdeye-plugins/thirdeye-postprocessors/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>thirdeye-plugins</artifactId>
<groupId>ai.startree.thirdeye.plugins</groupId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-scheduler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye</artifactId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<artifactId>thirdeye-scheduler</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye</artifactId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion thirdeye-spi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye</artifactId>
<version>1.416.0-SNAPSHOT</version>
<version>1.418.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
1 change: 1 addition & 0 deletions thirdeye-ui/e2e/pages/alert-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export class AlertDetailsPage extends BasePage {
this.alertsApiResponseData.length - 1
]?.name,
})
.nth(0)
.click();
}

Expand Down
7 changes: 5 additions & 2 deletions thirdeye-ui/e2e/pages/alert-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,11 @@ export class AlertListPage extends BasePage {
const jsonEditor = this.page.locator(".CodeMirror");
await jsonEditor.click();
const date = new Date();
const granularity = Math.ceil(Math.random() * 100);
const lookback = granularity * 6;
const editedAlert = `{"id": ${
topAlert.id
}, "name": "Clicks_SUM_mean-variance-rule-dup-edit${date.getTime()}","description": "","template": {"name": "startree-mean-variance"},"templateProperties": {"dataSource": "pinot","dataset": "AdCampaignData","aggregationColumn": "Clicks","aggregationFunction": "SUM","monitoringGranularity": "P1D","timezone": "UTC","queryFilters": "","sensitivity": "-6","lookback": "P21D"},"cron": "0 0 5 ? * MON-FRI *","auth": {"namespace": null}}`;
}, "name": "Clicks_SUM_mean-variance-rule-dup-edit${date.getTime()}","description": "","template": {"name": "startree-mean-variance"},"templateProperties": {"dataSource": "pinot","dataset": "AdCampaignData","aggregationColumn": "Clicks","aggregationFunction": "SUM","monitoringGranularity": "P${granularity}D","timezone": "UTC","queryFilters": "","sensitivity": "-6","lookback": "P${lookback}D"},"cron": "0 0 5 ? * MON-FRI *","auth": {"namespace": null}}`;
await this.page.evaluate((editedAlert) => {
const editor = document.querySelector(".CodeMirror")?.CodeMirror;
editor.setValue(editedAlert);
Expand All @@ -235,7 +237,7 @@ export class AlertListPage extends BasePage {
const evaluateApiResponse = this.page.waitForResponse(
"/api/alerts/evaluate"
);
await this.page.getByTestId("preview-chart-button").click();
this.page.getByTestId("preview-chart-button").click();

const insightRequest = await insightApiRequest;

Expand All @@ -250,6 +252,7 @@ export class AlertListPage extends BasePage {
const evaluateReq = JSON.parse(editedAlert);
delete evaluateReq.id;
expect(evaluateRequest.postDataJSON().alert).toEqual(evaluateReq);
this.page.waitForTimeout(1000);
const saveButtonAfterLoadChart = this.page.locator(
"#next-bottom-bar-btn"
);
Expand Down
2 changes: 1 addition & 1 deletion thirdeye-ui/e2e/pages/anomaly-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class AnomalyListPage extends BasePage {
const alert = this.alertResponseData.find(
(alert) => alert.id === anomaly.alert.id
);
await expect(allCoulmns[2]).toHaveText(alert.name);
await expect(allCoulmns[2]).toHaveText(alert?.name || "-");
await expect(allCoulmns[3]).toHaveText(
anomaly.metadata.metric.name
);
Expand Down
Loading

0 comments on commit 7912cee

Please sign in to comment.