From fd180ed6b2e8fb76906d0203905552456d0db327 Mon Sep 17 00:00:00 2001
From: Tyler Ohlsen
Date: Thu, 1 Dec 2022 13:06:15 -0800
Subject: [PATCH 01/21] Add branch constants in CI workflow (#345)
Signed-off-by: Tyler Ohlsen
---
.github/workflows/remote-integ-tests-workflow.yml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/remote-integ-tests-workflow.yml b/.github/workflows/remote-integ-tests-workflow.yml
index bf05f8ec..82458913 100644
--- a/.github/workflows/remote-integ-tests-workflow.yml
+++ b/.github/workflows/remote-integ-tests-workflow.yml
@@ -12,6 +12,8 @@ on:
env:
OPENSEARCH_DASHBOARDS_VERSION: 'main'
OPENSEARCH_VERSION: '3.0.0-SNAPSHOT'
+ OPENSEARCH_DASHBOARDS_FTREPO_VERSION: 'main'
+ ANOMALY_DETECTION_PLUGIN_VERSION: 'main'
jobs:
test-without-security:
name: Run integ tests without security
@@ -26,7 +28,7 @@ jobs:
with:
path: anomaly-detection
repository: opensearch-project/anomaly-detection
- ref: 'main'
+ ref: ${{ env.ANOMALY_DETECTION_PLUGIN_VERSION }}
- name: Run Opensearch with plugin
run: |
cd anomaly-detection
@@ -72,7 +74,7 @@ jobs:
with:
path: opensearch-dashboards-functional-test
repository: opensearch-project/opensearch-dashboards-functional-test
- ref: 'main' # TODO: change to a branch when the branching strategy in that repo has been established
+ ref: ${{ env.OPENSEARCH_DASHBOARDS_FTREPO_VERSION }}
- name: Get Cypress version
id: cypress_version
run: |
From 0ee7503e4cff5244d519e68802d6b2e4e6ffa713 Mon Sep 17 00:00:00 2001
From: Tyler Ohlsen
Date: Fri, 16 Dec 2022 09:59:03 -0800
Subject: [PATCH 02/21] Bump decode-uri-component (#359)
Signed-off-by: Tyler Ohlsen
---
package.json | 3 ++-
yarn.lock | 8 ++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index d997ca9d..42e3d382 100644
--- a/package.json
+++ b/package.json
@@ -49,6 +49,7 @@
"**/ansi-regex": "^5.0.1",
"**/glob-parent": "^6.0.0",
"**/loader-utils": "^2.0.4",
- "**/terser": "^4.8.1"
+ "**/terser": "^4.8.1",
+ "decode-uri-component": "^0.2.1"
}
}
diff --git a/yarn.lock b/yarn.lock
index 0abf4949..6841b7d3 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1070,10 +1070,10 @@ decamelize@^1.2.0:
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
-decode-uri-component@^0.2.0:
- version "0.2.0"
- resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545"
- integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=
+decode-uri-component@^0.2.0, decode-uri-component@^0.2.1:
+ version "0.2.2"
+ resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9"
+ integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==
dedent@^0.7.0:
version "0.7.0"
From 6eace8105c95a44c994e0e9b475d5426ad0f3e7e Mon Sep 17 00:00:00 2001
From: Amit Galitzky
Date: Thu, 22 Dec 2022 11:25:43 -0800
Subject: [PATCH 03/21] removed duplicate popout icon and ran prettier (#382)
Signed-off-by: Amit Galitzky
---
global-setup.js | 4 +-
.../FormattedFormRow/FormattedFormRow.tsx | 2 +-
public/models/interfaces.ts | 36 +-
.../components/AnomaliesStat/AnomalyStat.tsx | 2 +-
.../__snapshots__/AnomalyStat.test.tsx.snap | 28 +-
.../components/FeatureChart/FeatureChart.tsx | 27 +-
.../containers/AnomalyDetailsChart.tsx | 111 +--
.../containers/FeatureBreakDown.tsx | 8 +-
.../AnomalyCharts/utils/anomalyChartUtils.tsx | 4 +-
public/pages/AnomalyCharts/utils/constants.ts | 4 +-
.../CategoryField/CategoryField.tsx | 2 +-
.../__snapshots__/CategoryField.test.tsx.snap | 28 +-
.../components/Features/Features.tsx | 2 +-
.../containers/ConfigureModel.tsx | 2 +-
.../containers/SampleAnomalies.tsx | 2 +-
.../ConfigureModel.test.tsx.snap | 96 +-
.../EmptyDashboard/EmptyDashboard.tsx | 3 +-
.../EmptyDashboard.test.tsx.snap | 12 +-
.../CustomResultIndex/CustomResultIndex.tsx | 2 +-
.../components/Settings/Settings.tsx | 2 +-
.../__snapshots__/Settings.test.tsx.snap | 24 +-
.../DefineDetector.test.tsx.snap | 132 +--
.../MonitorCallout/MonitorCallout.tsx | 2 +-
.../MonitorCallout.test.tsx.snap | 11 -
.../HistoricalJob/HistoricalJob.tsx | 2 +-
.../__snapshots__/HistoricalJob.test.tsx.snap | 12 +-
.../components/RealTimeJob/RealTimeJob.tsx | 2 +-
.../__snapshots__/RealTimeJob.test.tsx.snap | 12 +-
.../__snapshots__/DetectorJobs.test.tsx.snap | 24 +-
.../containers/AnomalyResults.tsx | 12 +-
.../ConfirmActionModals/utils/helpers.tsx | 14 +-
.../EmptyHistoricalDetectorResults.tsx | 3 +-
...ptyHistoricalDetectorResults.test.tsx.snap | 12 +-
.../components/CreateWorkflowStepDetails.tsx | 2 +-
.../containers/AnomalyDetectionOverview.tsx | 2 +-
.../AnomalyDetectionOverview.test.tsx.snap | 220 +----
.../__tests__/anomalyResultUtils.test.ts | 837 ++++++++++++------
public/pages/utils/anomalyResultUtils.ts | 137 +--
server/routes/ad.ts | 29 +-
test/jest.config.js | 2 +-
40 files changed, 813 insertions(+), 1055 deletions(-)
diff --git a/global-setup.js b/global-setup.js
index 3c578000..67ca0db6 100644
--- a/global-setup.js
+++ b/global-setup.js
@@ -1,3 +1,3 @@
export default () => {
- process.env.TZ = 'UTC';
- }
\ No newline at end of file
+ process.env.TZ = 'UTC';
+};
diff --git a/public/components/FormattedFormRow/FormattedFormRow.tsx b/public/components/FormattedFormRow/FormattedFormRow.tsx
index 7a125664..20cf8daa 100644
--- a/public/components/FormattedFormRow/FormattedFormRow.tsx
+++ b/public/components/FormattedFormRow/FormattedFormRow.tsx
@@ -35,7 +35,7 @@ export const FormattedFormRow = (props: FormattedFormRowProps) => {
{props.hintLink ? ' ' : null}
{props.hintLink ? (
- Learn more
+ Learn more
) : null}
diff --git a/public/models/interfaces.ts b/public/models/interfaces.ts
index e2eea176..f8fbc248 100644
--- a/public/models/interfaces.ts
+++ b/public/models/interfaces.ts
@@ -82,27 +82,27 @@ export type FeatureAttributes = {
// all possible valid units accepted by the backend
export enum UNITS {
- NANOS = "Nanos",
- MICROS = "Micros",
- MILLIS = "Millis",
- SECONDS = "Seconds",
+ NANOS = 'Nanos',
+ MICROS = 'Micros',
+ MILLIS = 'Millis',
+ SECONDS = 'Seconds',
MINUTES = 'Minutes',
- HOURS = "Hours",
- HALF_DAYS = "HalfDays",
- DAYS = "Days",
- WEEKS = "Weeks",
- MONTHS = "Months",
- YEARS = "Years",
- DECADES = "Decades",
- CENTURIES = "Centuries",
- MILLENNIA = "Millennia",
- ERAS = "Eras",
- FOREVER = "Forever"
+ HOURS = 'Hours',
+ HALF_DAYS = 'HalfDays',
+ DAYS = 'Days',
+ WEEKS = 'Weeks',
+ MONTHS = 'Months',
+ YEARS = 'Years',
+ DECADES = 'Decades',
+ CENTURIES = 'Centuries',
+ MILLENNIA = 'Millennia',
+ ERAS = 'Eras',
+ FOREVER = 'Forever',
}
// cannot create a method in enum, have to write function separately
export function toDuration(units: UNITS): Duration {
- switch(units) {
+ switch (units) {
case UNITS.NANOS: {
// Duration in moment library does not support
return moment.duration(0.000000001, 'seconds');
@@ -155,7 +155,7 @@ export function toDuration(units: UNITS): Duration {
default:
break;
}
- throw new Error("Unexpected unit: " + units);
+ throw new Error('Unexpected unit: ' + units);
}
export type Schedule = {
@@ -235,7 +235,7 @@ export type AnomalyData = {
entity?: EntityData[];
features?: { [key: string]: FeatureAggregationData };
contributions?: { [key: string]: FeatureContributionData };
- aggInterval?: string;
+ aggInterval?: string;
};
export type FeatureAggregationData = {
diff --git a/public/pages/AnomalyCharts/components/AnomaliesStat/AnomalyStat.tsx b/public/pages/AnomalyCharts/components/AnomaliesStat/AnomalyStat.tsx
index 56c4db8c..2f82cccf 100644
--- a/public/pages/AnomalyCharts/components/AnomaliesStat/AnomalyStat.tsx
+++ b/public/pages/AnomalyCharts/components/AnomaliesStat/AnomalyStat.tsx
@@ -91,7 +91,7 @@ export const AlertsStat = (props: {
target="_blank"
style={{ fontSize: '14px' }}
>
- View monitor
+ View monitor
) : null}
diff --git a/public/pages/AnomalyCharts/components/AnomaliesStat/__tests__/__snapshots__/AnomalyStat.test.tsx.snap b/public/pages/AnomalyCharts/components/AnomaliesStat/__tests__/__snapshots__/AnomalyStat.test.tsx.snap
index fbc59913..4577f90a 100644
--- a/public/pages/AnomalyCharts/components/AnomaliesStat/__tests__/__snapshots__/AnomalyStat.test.tsx.snap
+++ b/public/pages/AnomalyCharts/components/AnomaliesStat/__tests__/__snapshots__/AnomalyStat.test.tsx.snap
@@ -38,21 +38,7 @@ exports[` spec Alert Stat renders component with monitor and loadi
style="font-size: 14px;"
target="_blank"
>
- View monitor
-
+ View monitor
spec Alert Stat renders component with monitor and not l
style="font-size: 14px;"
target="_blank"
>
- View monitor
-
+ View monitor
- ) : null}
+
+
+ {featureAttributionList}
+
+ ) : null}
);
};
-
const generateContributionAnomalyAnnotations = (
anomalies: AnomalyData[][]
): any[][] => {
let annotations = [] as any[];
anomalies.forEach((anomalyTimeSeries: AnomalyData[]) => {
annotations.push(
- Array.isArray(anomalyTimeSeries) ? (
- anomalyTimeSeries
- .filter((anomaly: AnomalyData) => anomaly.anomalyGrade > 0)
- .map((anomaly: AnomalyData) => (
- {
- coordinates: {
- x0: anomaly.startTime,
- x1: anomaly.endTime + (anomaly.endTime - anomaly.startTime),
- },
- details: `${JSON.stringify(anomaly)}`
- }))
- ) : []
+ Array.isArray(anomalyTimeSeries)
+ ? anomalyTimeSeries
+ .filter((anomaly: AnomalyData) => anomaly.anomalyGrade > 0)
+ .map((anomaly: AnomalyData) => ({
+ coordinates: {
+ x0: anomaly.startTime,
+ x1: anomaly.endTime + (anomaly.endTime - anomaly.startTime),
+ },
+ details: `${JSON.stringify(anomaly)}`,
+ }))
+ : []
);
});
return annotations;
@@ -601,7 +602,9 @@ export const AnomalyDetailsChart = React.memo(
/>
)}
-
+ />
+
{alertAnnotations ? (
- )
+ : props.anomalyGradeSeriesName;
+ return (
+
+ );
}
)}
diff --git a/public/pages/AnomalyCharts/containers/FeatureBreakDown.tsx b/public/pages/AnomalyCharts/containers/FeatureBreakDown.tsx
index 51dd1318..e939e64d 100644
--- a/public/pages/AnomalyCharts/containers/FeatureBreakDown.tsx
+++ b/public/pages/AnomalyCharts/containers/FeatureBreakDown.tsx
@@ -176,11 +176,9 @@ export const FeatureBreakDown = React.memo((props: FeatureBreakDownProps) => {
detectorEnabledTime={props.detector.enabledTime}
entityData={getEntityDataForChart(props.anomalyAndFeatureResults)}
isHCDetector={props.isHCDetector}
- windowDelay={
- get(props, `detector.windowDelay.period`, {
- period: { interval: 0, unit: UNITS.MINUTES },
- })
- }
+ windowDelay={get(props, `detector.windowDelay.period`, {
+ period: { interval: 0, unit: UNITS.MINUTES },
+ })}
/>
{index + 1 ===
get(props, 'detector.featureAttributes', []).length ? null : (
diff --git a/public/pages/AnomalyCharts/utils/anomalyChartUtils.tsx b/public/pages/AnomalyCharts/utils/anomalyChartUtils.tsx
index 23c7031d..b2603ada 100644
--- a/public/pages/AnomalyCharts/utils/anomalyChartUtils.tsx
+++ b/public/pages/AnomalyCharts/utils/anomalyChartUtils.tsx
@@ -640,9 +640,7 @@ export const getFeatureBreakdownWording = (
return isNotSample ? 'Feature breakdown' : 'Sample feature breakdown';
};
-export const getFeatureDataWording = (
- isNotSample: boolean | undefined
-) => {
+export const getFeatureDataWording = (isNotSample: boolean | undefined) => {
return isNotSample ? 'Feature output' : 'Sample feature output';
};
diff --git a/public/pages/AnomalyCharts/utils/constants.ts b/public/pages/AnomalyCharts/utils/constants.ts
index 5b699a1b..88afc988 100644
--- a/public/pages/AnomalyCharts/utils/constants.ts
+++ b/public/pages/AnomalyCharts/utils/constants.ts
@@ -24,7 +24,7 @@ export enum CHART_FIELDS {
CONFIDENCE = 'confidence',
DATA = 'data',
AGG_INTERVAL = 'aggInterval',
- EXPECTED_VALUE = 'expectedValue'
+ EXPECTED_VALUE = 'expectedValue',
}
export enum CHART_COLORS {
@@ -91,7 +91,7 @@ export const DEFAULT_ANOMALY_SUMMARY = {
maxAnomalyGrade: 0,
minConfidence: 0,
maxConfidence: 0,
- lastAnomalyOccurrence: '-'
+ lastAnomalyOccurrence: '-',
};
export const HEATMAP_CHART_Y_AXIS_WIDTH = 30;
diff --git a/public/pages/ConfigureModel/components/CategoryField/CategoryField.tsx b/public/pages/ConfigureModel/components/CategoryField/CategoryField.tsx
index 9afe53a1..130e64d5 100644
--- a/public/pages/ConfigureModel/components/CategoryField/CategoryField.tsx
+++ b/public/pages/ConfigureModel/components/CategoryField/CategoryField.tsx
@@ -76,7 +76,7 @@ export function CategoryField(props: CategoryFieldProps) {
Split a single time series into multiple time series based on
categorical fields. You can select up to 2.{' '}
- Learn more
+ Learn more
}
diff --git a/public/pages/ConfigureModel/components/CategoryField/__tests__/__snapshots__/CategoryField.test.tsx.snap b/public/pages/ConfigureModel/components/CategoryField/__tests__/__snapshots__/CategoryField.test.tsx.snap
index a1117607..557d3b8d 100644
--- a/public/pages/ConfigureModel/components/CategoryField/__tests__/__snapshots__/CategoryField.test.tsx.snap
+++ b/public/pages/ConfigureModel/components/CategoryField/__tests__/__snapshots__/CategoryField.test.tsx.snap
@@ -50,17 +50,7 @@ exports[` spec renders the component when disabled 1`] = `
rel="noopener noreferrer"
target="_blank"
>
- Learn more
-
+ Learn more
spec renders the component when enabled 1`] = `
rel="noopener noreferrer"
target="_blank"
>
- Learn more
-
+ Learn more