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
{featureName}: {dataString}
- ) - }) + ); + }); } else { for (const [, value] of Object.entries(contributionData)) { featureAttributionList.push(
{value.name}: {value.attribution}
- ) + ); } } return ( @@ -379,35 +382,33 @@ export const AnomalyDetailsChart = React.memo( Feature Contribution: {anomaly ? ( -

-


- {featureAttributionList} -

- ) : 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 - Learn more + Learn more } diff --git a/public/pages/ConfigureModel/containers/ConfigureModel.tsx b/public/pages/ConfigureModel/containers/ConfigureModel.tsx index 9c589374..b2a21696 100644 --- a/public/pages/ConfigureModel/containers/ConfigureModel.tsx +++ b/public/pages/ConfigureModel/containers/ConfigureModel.tsx @@ -249,7 +249,7 @@ export function ConfigureModel(props: ConfigureModelProps) { and other optional parameters, you can preview your anomalies from a sample feature output.{' '} - Learn more + Learn more diff --git a/public/pages/ConfigureModel/containers/SampleAnomalies.tsx b/public/pages/ConfigureModel/containers/SampleAnomalies.tsx index 7040215c..a6ad30ad 100644 --- a/public/pages/ConfigureModel/containers/SampleAnomalies.tsx +++ b/public/pages/ConfigureModel/containers/SampleAnomalies.tsx @@ -204,7 +204,7 @@ export function SampleAnomalies(props: SampleAnomaliesProps) { ? 'You can preview how your anomalies may look like from sample feature output and adjust the feature settings as needed.' : 'Use the sample data as a reference to fine tune settings. To see the latest preview with your adjustments, click "Refresh preview". Once you are done with your edits, save your changes and run the detector to see real time anomalies for the new data set.'}{' '} - Learn more + Learn more diff --git a/public/pages/ConfigureModel/containers/__tests__/__snapshots__/ConfigureModel.test.tsx.snap b/public/pages/ConfigureModel/containers/__tests__/__snapshots__/ConfigureModel.test.tsx.snap index fdf2f51c..3c171c09 100644 --- a/public/pages/ConfigureModel/containers/__tests__/__snapshots__/ConfigureModel.test.tsx.snap +++ b/public/pages/ConfigureModel/containers/__tests__/__snapshots__/ConfigureModel.test.tsx.snap @@ -35,17 +35,7 @@ exports[` spec creating model configuration renders the compon rel="noopener noreferrer" target="_blank" > - Learn more - + Learn more spec creating model configuration renders the compon rel="noopener noreferrer" target="_blank" > - Learn more - + Learn more spec creating model configuration renders the compon rel="noopener noreferrer" target="_blank" > - Learn more - + Learn more spec creating model configuration renders the compon rel="noopener noreferrer" target="_blank" > - Learn more - + Learn more spec editing model configuration renders the compone rel="noopener noreferrer" target="_blank" > - Learn more - + Learn more spec editing model configuration renders the compone rel="noopener noreferrer" target="_blank" > - Learn more - + Learn more spec editing model configuration renders the compone rel="noopener noreferrer" target="_blank" > - Learn more - + Learn more {

Read about{' '} - Get started with Anomaly detection   - + Get started with Anomaly detection {' '}

diff --git a/public/pages/Dashboard/Components/EmptyDashboard/__tests__/__snapshots__/EmptyDashboard.test.tsx.snap b/public/pages/Dashboard/Components/EmptyDashboard/__tests__/__snapshots__/EmptyDashboard.test.tsx.snap index 57fb8f90..03d27a8e 100644 --- a/public/pages/Dashboard/Components/EmptyDashboard/__tests__/__snapshots__/EmptyDashboard.test.tsx.snap +++ b/public/pages/Dashboard/Components/EmptyDashboard/__tests__/__snapshots__/EmptyDashboard.test.tsx.snap @@ -34,17 +34,7 @@ exports[` spec Empty results renders component with empty messa rel="noopener noreferrer" target="_blank" > - Get started with Anomaly detection   - + Get started with Anomaly detection

- Attempting to initialize the detector with historical data. This - initializing process takes approximately{' '} - {get(detector, 'detectionInterval.period.interval', 10)}{' '} - minutes. + Attempting to initialize the detector with historical data. + This initializing process takes approximately 1 minute if + you have data in each of the last 40 consecutive intervals.

From 5caf60867d8cb72798d7e6ccf1786ead1f71f876 Mon Sep 17 00:00:00 2001 From: Kaituo Li Date: Mon, 30 Jan 2023 09:36:18 -0800 Subject: [PATCH 11/21] upgrade filter bug (#402) Previously, we didn't actually add filter type when loading old detector. This PR fixed that. Testing done: 1. added a unit tes 2. verified e2et Signed-off-by: Kaituo Li --- .../utils/__tests__/helpers.test.tsx | 60 ++++++++++++++++++- public/pages/DefineDetector/utils/helpers.ts | 8 +-- 2 files changed, 61 insertions(+), 7 deletions(-) diff --git a/public/pages/DefineDetector/utils/__tests__/helpers.test.tsx b/public/pages/DefineDetector/utils/__tests__/helpers.test.tsx index e44682f6..b6d9590d 100644 --- a/public/pages/DefineDetector/utils/__tests__/helpers.test.tsx +++ b/public/pages/DefineDetector/utils/__tests__/helpers.test.tsx @@ -10,12 +10,13 @@ */ import { INITIAL_DETECTOR_DEFINITION_VALUES } from '../../utils/constants'; +import { DATA_TYPES } from '../../../../utils/constants'; import { getRandomDetector } from '../../../../redux/reducers/__tests__/utils'; import { detectorDefinitionToFormik, filtersToFormik, } from '../../utils/helpers'; -import { Detector } from '../../../../models/interfaces'; +import { Detector, OPERATORS_MAP, FILTER_TYPES } from '../../../../models/interfaces'; describe('detectorDefinitionToFormik', () => { test('should return initialValues if detector is null', () => { @@ -53,4 +54,61 @@ describe('detectorDefinitionToFormik', () => { windowDelay: randomDetector.windowDelay.period.interval, }); }); + test('upgrade old detector\'s filters to include filter type', () => { + const randomDetector = getRandomDetector(); + randomDetector.uiMetadata = { + features: {}, + filters : [ + { + fieldInfo : [ + { + label : 'service', + type : DATA_TYPES.KEYWORD + } + ], + fieldValue : "app_3", + operator : OPERATORS_MAP.IS + }, + { + fieldInfo : [ + { + label : "host", + type : DATA_TYPES.KEYWORD + } + ], + fieldValue : "server_2", + operator : OPERATORS_MAP.IS + } + ], + filterType : FILTER_TYPES.SIMPLE + }; + const adFormikValues = filtersToFormik(randomDetector); + expect(adFormikValues).toEqual( + [ + { + fieldInfo : [ + { + label : 'service', + type : DATA_TYPES.KEYWORD + } + ], + fieldValue : "app_3", + operator : OPERATORS_MAP.IS, + filterType : FILTER_TYPES.SIMPLE + }, + { + fieldInfo : [ + { + label : "host", + type : DATA_TYPES.KEYWORD + } + ], + fieldValue : "server_2", + operator : OPERATORS_MAP.IS, + filterType : FILTER_TYPES.SIMPLE + } + ] + ); + }); + }); diff --git a/public/pages/DefineDetector/utils/helpers.ts b/public/pages/DefineDetector/utils/helpers.ts index 579a500f..fd427913 100644 --- a/public/pages/DefineDetector/utils/helpers.ts +++ b/public/pages/DefineDetector/utils/helpers.ts @@ -89,12 +89,8 @@ export function filtersToFormik(detector: Detector): UIFilter[] { }, ]; } else { - curFilters.forEach((filter: UIFilter) => { - return { - ...filter, - filterType: curFilterType, - }; - }); + curFilters.forEach((filter: UIFilter) => + filter.filterType = curFilterType); } } return curFilters; From e7ac41749ad8e5f19d9038570a03870d9ce8332f Mon Sep 17 00:00:00 2001 From: Kaituo Li Date: Thu, 9 Feb 2023 13:38:56 -0800 Subject: [PATCH 12/21] Changed required minimum intervals in cold start message (#411) Required minimum intervals to finish cold start is related to shingle size. This PR adds the shingle size in the computation and puts the result in the cold start message. Testing done: 1. verified changing shingle size will change the message. Signed-off-by: Kaituo Li --- public/pages/DetectorResults/containers/AnomalyResults.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/pages/DetectorResults/containers/AnomalyResults.tsx b/public/pages/DetectorResults/containers/AnomalyResults.tsx index 9759b121..2e769d08 100644 --- a/public/pages/DetectorResults/containers/AnomalyResults.tsx +++ b/public/pages/DetectorResults/containers/AnomalyResults.tsx @@ -66,6 +66,7 @@ import { detectorIsSample } from '../../Overview/utils/helpers'; import { SampleIndexDetailsCallout } from '../../Overview/components/SampleIndexDetailsCallout/SampleIndexDetailsCallout'; import { CoreStart } from '../../../../../../src/core/public'; import { CoreServicesContext } from '../../../components/CoreServices/CoreServices'; +import { DEFAULT_SHINGLE_SIZE } from '../../../utils/constants'; interface AnomalyResultsProps extends RouteComponentProps { detectorId: string; @@ -313,7 +314,8 @@ export function AnomalyResults(props: AnomalyResultsProps) {

Attempting to initialize the detector with historical data. This initializing process takes approximately 1 minute if - you have data in each of the last 40 consecutive intervals. + you have data in each of the last{' '} + {32+get(detector, 'shingleSize', DEFAULT_SHINGLE_SIZE)}{' '} consecutive intervals.

From 015fde01b09523b70672c7388f6a9a93031cf10f Mon Sep 17 00:00:00 2001 From: Tyler Ohlsen Date: Mon, 13 Feb 2023 16:58:15 -0800 Subject: [PATCH 13/21] Bump @sideway/formula to 3.0.1 (#418) 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 1307bc17..a6875522 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "**/loader-utils": "^2.0.4", "**/terser": "^4.8.1", "decode-uri-component": "^0.2.1", - "json5": "^2.2.3" + "json5": "^2.2.3", + "@sideway/formula": "^3.0.1" } } diff --git a/yarn.lock b/yarn.lock index e3015264..b838e0eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -60,10 +60,10 @@ dependencies: "@hapi/hoek" "^9.0.0" -"@sideway/formula@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.0.tgz#fe158aee32e6bd5de85044be615bc08478a0a13c" - integrity sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg== +"@sideway/formula@^3.0.0", "@sideway/formula@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.1.tgz#80fcbcbaf7ce031e0ef2dd29b1bfc7c3f583611f" + integrity sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg== "@sideway/pinpoint@^2.0.0": version "2.0.0" From 24cec7a79d9027520f2795cad80346e654c8a966 Mon Sep 17 00:00:00 2001 From: Tyler Ohlsen Date: Wed, 15 Feb 2023 10:34:38 -0800 Subject: [PATCH 14/21] Remove auto_expand_replicas override in sample data indices (#423) Signed-off-by: Tyler Ohlsen --- public/pages/Overview/utils/constants.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/pages/Overview/utils/constants.tsx b/public/pages/Overview/utils/constants.tsx index 4b2536c3..0e62c05c 100644 --- a/public/pages/Overview/utils/constants.tsx +++ b/public/pages/Overview/utils/constants.tsx @@ -14,11 +14,10 @@ import moment from 'moment'; import React from 'react'; import { EuiIcon } from '@elastic/eui'; -// same as default OpenSearch Dashboards sample data +// We don't need to specify auto_expand_replicas - use cluster defaults instead export const indexSettings = { index: { number_of_shards: 1, - auto_expand_replicas: '0-1', }, }; From 0b0bc37a36ce7f73857e47a2ca0157dea3b19f7a Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Mon, 20 Feb 2023 18:18:28 -0500 Subject: [PATCH 15/21] Created untriaged issue workflow. (#422) Signed-off-by: dblock --- .github/workflows/add-untriaged.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/add-untriaged.yml diff --git a/.github/workflows/add-untriaged.yml b/.github/workflows/add-untriaged.yml new file mode 100644 index 00000000..9dcc7020 --- /dev/null +++ b/.github/workflows/add-untriaged.yml @@ -0,0 +1,19 @@ +name: Apply 'untriaged' label during issue lifecycle + +on: + issues: + types: [opened, reopened, transferred] + +jobs: + apply-label: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v6 + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['untriaged'] + }) From 75832b6de5a2ad2e8a014d6e8141ff3ce14c1b26 Mon Sep 17 00:00:00 2001 From: Tyler Ohlsen Date: Mon, 20 Feb 2023 15:22:22 -0800 Subject: [PATCH 16/21] Add 2.6 release notes (#429) Signed-off-by: Tyler Ohlsen --- ...etection-dashboards.release-notes-2.6.0.0.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 release-notes/opensearch-anomaly-detection-dashboards.release-notes-2.6.0.0.md diff --git a/release-notes/opensearch-anomaly-detection-dashboards.release-notes-2.6.0.0.md b/release-notes/opensearch-anomaly-detection-dashboards.release-notes-2.6.0.0.md new file mode 100644 index 00000000..2e217ea4 --- /dev/null +++ b/release-notes/opensearch-anomaly-detection-dashboards.release-notes-2.6.0.0.md @@ -0,0 +1,17 @@ +## Version 2.6.0.0 Release Notes + +Compatible with OpenSearch Dashboards 2.6.0 + +### Enhancements + +* Update cold start message ([#398](https://github.com/opensearch-project/anomaly-detection-dashboards-plugin/pull/398)) +* Changed required minimum intervals in cold start message ([#411](https://github.com/opensearch-project/anomaly-detection-dashboards-plugin/pull/411)) +* Remove `auto_expand_replicas` override in sample data indices ([#423](https://github.com/opensearch-project/anomaly-detection-dashboards-plugin/pull/423)) + +### Bug Fixes + +* upgrade filter bug ([#402](https://github.com/opensearch-project/anomaly-detection-dashboards-plugin/pull/402)) + +### Infrastructure + +* Bump @sideway/formula to 3.0.1 ([#418](https://github.com/opensearch-project/anomaly-detection-dashboards-plugin/pull/418)) From bb3f1854411b01744a77e01fa722793933da3322 Mon Sep 17 00:00:00 2001 From: Miki Date: Wed, 22 Feb 2023 10:40:28 -0800 Subject: [PATCH 17/21] Fix Node.js and Yarn installation in CI (#433) Signed-off-by: Miki --- .../workflows/remote-integ-tests-workflow.yml | 25 +++++++++---------- .github/workflows/unit-tests-workflow.yml | 23 ++++++++--------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/.github/workflows/remote-integ-tests-workflow.yml b/.github/workflows/remote-integ-tests-workflow.yml index d57e3b67..55991557 100644 --- a/.github/workflows/remote-integ-tests-workflow.yml +++ b/.github/workflows/remote-integ-tests-workflow.yml @@ -64,23 +64,22 @@ jobs: with: path: OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin - - name: Get node and yarn versions - id: versions_step - run: | - echo "::set-output name=node_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")" - echo "::set-output name=yarn_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.yarn).match(/[.0-9]+/)[0]")" - - - name: Setup node - uses: actions/setup-node@v1 + - name: Setup Node + uses: actions/setup-node@v3 with: - node-version: ${{ steps.versions_step.outputs.node_version }} + node-version-file: './OpenSearch-Dashboards/.nvmrc' registry-url: 'https://registry.npmjs.org' - - name: Install correct yarn version for OpenSearch Dashboards + - name: Install Yarn + # Need to use bash to avoid having a windows/linux specific step + shell: bash run: | - npm uninstall -g yarn - echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}" - npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }} + YARN_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').engines.yarn") + echo "Installing yarn@$YARN_VERSION" + npm i -g yarn@$YARN_VERSION + + - run: node -v + - run: yarn -v - name: Bootstrap the plugin run: | diff --git a/.github/workflows/unit-tests-workflow.yml b/.github/workflows/unit-tests-workflow.yml index 838d9ae2..abe1743c 100644 --- a/.github/workflows/unit-tests-workflow.yml +++ b/.github/workflows/unit-tests-workflow.yml @@ -26,21 +26,20 @@ jobs: repository: opensearch-project/OpenSearch-Dashboards ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }} path: OpenSearch-Dashboards - - name: Get node and yarn versions - id: versions_step - run: | - echo "::set-output name=node_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")" - echo "::set-output name=yarn_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.yarn).match(/[.0-9]+/)[0]")" - - name: Setup node - uses: actions/setup-node@v1 + - name: Setup Node + uses: actions/setup-node@v3 with: - node-version: ${{ steps.versions_step.outputs.node_version }} + node-version-file: './OpenSearch-Dashboards/.nvmrc' registry-url: 'https://registry.npmjs.org' - - name: Install correct yarn version for OpenSearch Dashboards + - name: Install Yarn + # Need to use bash to avoid having a windows/linux specific step + shell: bash run: | - npm uninstall -g yarn - echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}" - npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }} + YARN_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').engines.yarn") + echo "Installing yarn@$YARN_VERSION" + npm i -g yarn@$YARN_VERSION + - run: node -v + - run: yarn -v - name: Checkout Anomaly Detection OpenSearch Dashboards plugin uses: actions/checkout@v2 with: From 95fd0fd33d0490e893c9b104b0665de9b4c8329d Mon Sep 17 00:00:00 2001 From: Jackie Han Date: Mon, 27 Mar 2023 16:08:43 -0700 Subject: [PATCH 18/21] run prettier command against all files (#444) Signed-off-by: Jackie Han --- .../containers/AnomaliesChart.tsx | 9 +- .../containers/AnomalyDetailsChart.tsx | 16 ++-- .../utils/__tests__/helpers.test.tsx | 89 ++++++++++--------- public/pages/DefineDetector/utils/helpers.ts | 5 +- .../containers/AnomalyResults.tsx | 9 +- 5 files changed, 66 insertions(+), 62 deletions(-) diff --git a/public/pages/AnomalyCharts/containers/AnomaliesChart.tsx b/public/pages/AnomalyCharts/containers/AnomaliesChart.tsx index a380f806..0a9a4e03 100644 --- a/public/pages/AnomalyCharts/containers/AnomaliesChart.tsx +++ b/public/pages/AnomalyCharts/containers/AnomaliesChart.tsx @@ -110,13 +110,10 @@ export const AnomaliesChart = React.memo((props: AnomaliesChartProps) => { const handleDateRangeChange = (startDate: number, endDate: number) => { props.onDateRangeChange(startDate, endDate); props.onZoomRangeChange(startDate, endDate); - if ( - !props.isHistorical && - endDate < get(props, 'detector.enabledTime') - ) { - setShowOutOfRangeCallOut(true) + if (!props.isHistorical && endDate < get(props, 'detector.enabledTime')) { + setShowOutOfRangeCallOut(true); } else { - setShowOutOfRangeCallOut(false) + setShowOutOfRangeCallOut(false); } }; diff --git a/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx b/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx index 0743f46c..e2116e30 100644 --- a/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx +++ b/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx @@ -427,15 +427,19 @@ export const AnomalyDetailsChart = React.memo( return ( {props.openOutOfRangeCallOut ? ( - - {`Your selected dates are not in the range from when the detector + + {`Your selected dates are not in the range from when the detector last started streaming data - (${moment(get(props, 'detector.enabledTime')).format('MM/DD/YYYY hh:mm A')}).`} + (${moment(get(props, 'detector.enabledTime')).format( + 'MM/DD/YYYY hh:mm A' + )}).`} ) : null} - + { test('should return initialValues if detector is null', () => { @@ -54,61 +58,58 @@ describe('detectorDefinitionToFormik', () => { windowDelay: randomDetector.windowDelay.period.interval, }); }); - test('upgrade old detector\'s filters to include filter type', () => { + test("upgrade old detector's filters to include filter type", () => { const randomDetector = getRandomDetector(); randomDetector.uiMetadata = { features: {}, - filters : [ + filters: [ { - fieldInfo : [ + fieldInfo: [ { - label : 'service', - type : DATA_TYPES.KEYWORD - } + label: 'service', + type: DATA_TYPES.KEYWORD, + }, ], - fieldValue : "app_3", - operator : OPERATORS_MAP.IS + fieldValue: 'app_3', + operator: OPERATORS_MAP.IS, }, { - fieldInfo : [ + fieldInfo: [ { - label : "host", - type : DATA_TYPES.KEYWORD - } + label: 'host', + type: DATA_TYPES.KEYWORD, + }, ], - fieldValue : "server_2", - operator : OPERATORS_MAP.IS - } + fieldValue: 'server_2', + operator: OPERATORS_MAP.IS, + }, ], - filterType : FILTER_TYPES.SIMPLE + filterType: FILTER_TYPES.SIMPLE, }; const adFormikValues = filtersToFormik(randomDetector); - expect(adFormikValues).toEqual( - [ - { - fieldInfo : [ - { - label : 'service', - type : DATA_TYPES.KEYWORD - } - ], - fieldValue : "app_3", - operator : OPERATORS_MAP.IS, - filterType : FILTER_TYPES.SIMPLE - }, - { - fieldInfo : [ - { - label : "host", - type : DATA_TYPES.KEYWORD - } - ], - fieldValue : "server_2", - operator : OPERATORS_MAP.IS, - filterType : FILTER_TYPES.SIMPLE - } - ] - ); + expect(adFormikValues).toEqual([ + { + fieldInfo: [ + { + label: 'service', + type: DATA_TYPES.KEYWORD, + }, + ], + fieldValue: 'app_3', + operator: OPERATORS_MAP.IS, + filterType: FILTER_TYPES.SIMPLE, + }, + { + fieldInfo: [ + { + label: 'host', + type: DATA_TYPES.KEYWORD, + }, + ], + fieldValue: 'server_2', + operator: OPERATORS_MAP.IS, + filterType: FILTER_TYPES.SIMPLE, + }, + ]); }); - }); diff --git a/public/pages/DefineDetector/utils/helpers.ts b/public/pages/DefineDetector/utils/helpers.ts index fd427913..f9e9ae45 100644 --- a/public/pages/DefineDetector/utils/helpers.ts +++ b/public/pages/DefineDetector/utils/helpers.ts @@ -89,8 +89,9 @@ export function filtersToFormik(detector: Detector): UIFilter[] { }, ]; } else { - curFilters.forEach((filter: UIFilter) => - filter.filterType = curFilterType); + curFilters.forEach( + (filter: UIFilter) => (filter.filterType = curFilterType) + ); } } return curFilters; diff --git a/public/pages/DetectorResults/containers/AnomalyResults.tsx b/public/pages/DetectorResults/containers/AnomalyResults.tsx index 2e769d08..827570ce 100644 --- a/public/pages/DetectorResults/containers/AnomalyResults.tsx +++ b/public/pages/DetectorResults/containers/AnomalyResults.tsx @@ -312,10 +312,11 @@ export function AnomalyResults(props: AnomalyResultsProps) { />

- Attempting to initialize the detector with historical data. - This initializing process takes approximately 1 minute if - you have data in each of the last{' '} - {32+get(detector, 'shingleSize', DEFAULT_SHINGLE_SIZE)}{' '} consecutive intervals. + Attempting to initialize the detector with historical data. This + initializing process takes approximately 1 minute if you have + data in each of the last{' '} + {32 + get(detector, 'shingleSize', DEFAULT_SHINGLE_SIZE)}{' '} + consecutive intervals.

From f0e30161f71d95453d6a731af68024bb9a65c46a Mon Sep 17 00:00:00 2001 From: Jackie Han Date: Mon, 17 Apr 2023 12:52:16 -0700 Subject: [PATCH 19/21] Add 2.7 release notes (#456) Signed-off-by: Jackie Han --- ...h-anomaly-detection-dashboards.release-notes-2.7.0.0.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 release-notes/opensearch-anomaly-detection-dashboards.release-notes-2.7.0.0.md diff --git a/release-notes/opensearch-anomaly-detection-dashboards.release-notes-2.7.0.0.md b/release-notes/opensearch-anomaly-detection-dashboards.release-notes-2.7.0.0.md new file mode 100644 index 00000000..dc6c1a53 --- /dev/null +++ b/release-notes/opensearch-anomaly-detection-dashboards.release-notes-2.7.0.0.md @@ -0,0 +1,7 @@ +## Version 2.7.0.0 Release Notes + +Compatible with OpenSearch Dashboards 2.7.0 + +### Enhancements + +* Run prettier command against all files ([#444](https://github.com/opensearch-project/anomaly-detection-dashboards-plugin/pull/444)) From 710e3c4ddadf3689b7f014b5df88f2a82b8db999 Mon Sep 17 00:00:00 2001 From: Amit Galitzky Date: Tue, 9 May 2023 19:12:34 +0300 Subject: [PATCH 20/21] updating maintainers and code owners (#476) Signed-off-by: Amit Galitzky --- .github/CODEOWNERS | 3 +-- MAINTAINERS.md | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index cd025f06..48711d5f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1 @@ -# This should match the owning team set up in https://github.com/orgs/opensearch-project/teams -* @opensearch-project/anomaly-detection \ No newline at end of file +* @ohltyler @kaituo @jackiehanyang @amitgalitz @sean-zheng-amazon \ No newline at end of file diff --git a/MAINTAINERS.md b/MAINTAINERS.md index bafb14f5..9b4551dd 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -4,10 +4,19 @@ This document contains a list of maintainers in this repo. See [opensearch-proje ## Current Maintainers -| Maintainer | GitHub ID | Affiliation | -| ----------------------- | ------------------------------------------------------- | ----------- | -| Tyler Ohlsen | [ohltyler](https://github.com/ohltyler) | Amazon | +| Maintainer | GitHub ID | Affiliation | +| ----------------------- | -------------------------------------------------------- | ----------- | +| Tyler Ohlsen | [ohltyler](https://github.com/ohltyler) | Amazon | +| Kaituo Li | [kaituo](https://github.com/kaituo) | Amazon | +| Jackie Han | [jackiehanyang](https://github.com/jackiehanyang) | Amazon | +| Amit Galitzky | [amitgalitz](https://github.com/amitgalitz) | Amazon | +| Sean Zheng | [sean-zheng-amazon](https://github.com/sean-zheng-amazon)| Amazon | + +## Emeritus Maintainers + +| Maintainer | GitHub ID | Affiliation | +| ----------------- | ------------------------------------------------------- | ----------- | | Yaliang | [ylwu-amzn](https://github.com/ylwu-amzn) | Amazon | | Yizhe Liu | [yizheliu-amazon](https://github.com/yizheliu-amazon) | Amazon | | Vijayan Balasubramanian | [VijayanB](https://github.com/VijayanB) | Amazon | -| Sarat Vemulapalli | [saratvemulapalli](https://github.com/saratvemulapalli) | Amazon | +| Sarat Vemulapalli | [saratvemulapalli](https://github.com/saratvemulapalli) | Amazon | \ No newline at end of file From 93ba127f9ec2925fcdd33e9454e459fefd2ec227 Mon Sep 17 00:00:00 2001 From: Amit Galitzky Date: Wed, 24 May 2023 13:49:47 -0700 Subject: [PATCH 21/21] fixing test to pass with node 18 (#491) Signed-off-by: Amit Galitzky --- .../__tests__/NameAndDescription.test.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/public/pages/DefineDetector/components/NameAndDescription/__tests__/NameAndDescription.test.tsx b/public/pages/DefineDetector/components/NameAndDescription/__tests__/NameAndDescription.test.tsx index 32b564fa..dbd5908c 100644 --- a/public/pages/DefineDetector/components/NameAndDescription/__tests__/NameAndDescription.test.tsx +++ b/public/pages/DefineDetector/components/NameAndDescription/__tests__/NameAndDescription.test.tsx @@ -29,11 +29,14 @@ describe(' spec', () => { expect(container.firstChild).toMatchSnapshot(); }); test('shows error for detector name input when toggling focus/blur', async () => { - const handleValidateName = jest.fn().mockImplementation(() => { - throw 'Required'; + const handleValidateName = jest.fn().mockImplementationOnce(() => { + return 'Required'; }); const { queryByText, findByText, getByPlaceholderText } = render( - + {() => (
@@ -49,6 +52,7 @@ describe(' spec', () => { expect(handleValidateName).toHaveBeenCalledTimes(1); expect(findByText('Required')).not.toBeNull(); }); + test('shows error for detector description input when toggling focus/bur', async () => { const { queryByText, findByText, getByPlaceholderText } = render(