-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[ML] Anomaly Detection: Migrate validation messages links to use docLinks. #94568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
walterra
merged 10 commits into
elastic:master
from
walterra:ml-move-validation-message-parsing-to-client
Mar 17, 2021
Merged
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
16b05c8
[ML] Move validation message parsing to client.
walterra fc6c1cb
[ML] Migrate validation messages to use docLinks service.
walterra e4adf5e
[Ml] Update API integration tests.
walterra 4dc08c6
[ML] Jest tests for parseMessages(). Shared mocks for API integration…
walterra 868af4e
[ML] Remove no longer needed code from jest tests.
walterra aca29ae
Update anomalyDetectionJobResource link.
walterra ece2087
Update anomalyDetectionJobResourceAnalysisConfig link.
walterra 06bf6c5
[ML] Fix jest test.
walterra dcefb8e
Merge branch 'ml-move-validation-message-parsing-to-client' of github…
walterra 544525f
Merge branch 'master' into ml-move-validation-message-parsing-to-client
walterra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| /* To keep tests in sync, these mocks should be used in API intregation tests | ||
| * as expected values to check against, and in the client side jest tests to be | ||
| * the values used as function arguments for `parseMessages()` to retrieve the | ||
| * messages populated with translations and documentation links. | ||
| */ | ||
|
|
||
| export const basicValidJobMessages = [ | ||
| { | ||
| id: 'job_id_valid', | ||
| }, | ||
| { | ||
| id: 'detectors_function_not_empty', | ||
| }, | ||
| { | ||
| id: 'success_bucket_span', | ||
| bucketSpan: '15m', | ||
| }, | ||
| { | ||
| id: 'success_time_range', | ||
| }, | ||
| { | ||
| id: 'success_mml', | ||
| }, | ||
| ]; | ||
|
|
||
| export const basicInvalidJobMessages = [ | ||
| { | ||
| id: 'job_id_invalid', | ||
| }, | ||
| { | ||
| id: 'detectors_function_not_empty', | ||
| }, | ||
| { | ||
| id: 'bucket_span_valid', | ||
| bucketSpan: '15m', | ||
| }, | ||
| { | ||
| id: 'skipped_extended_tests', | ||
| }, | ||
| ]; | ||
|
|
||
| export const nonBasicIssuesMessages = [ | ||
| { | ||
| id: 'job_id_valid', | ||
| }, | ||
| { | ||
| id: 'detectors_function_not_empty', | ||
| }, | ||
| { | ||
| id: 'cardinality_model_plot_high', | ||
| }, | ||
| { | ||
| id: 'cardinality_partition_field', | ||
| fieldName: 'order_id', | ||
| }, | ||
| { | ||
| id: 'bucket_span_high', | ||
| }, | ||
| { | ||
| bucketSpanCompareFactor: 25, | ||
| id: 'time_range_short', | ||
| minTimeSpanReadable: '2 hours', | ||
| }, | ||
| { | ||
| id: 'success_influencers', | ||
| }, | ||
| { | ||
| id: 'half_estimated_mml_greater_than_mml', | ||
| mml: '1MB', | ||
| }, | ||
| { | ||
| id: 'missing_summary_count_field_name', | ||
| }, | ||
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import { docLinksServiceMock } from 'src/core/public/mocks'; | ||
|
|
||
| import { parseMessages } from './messages'; | ||
|
|
||
| import { | ||
| basicValidJobMessages, | ||
| basicInvalidJobMessages, | ||
| nonBasicIssuesMessages, | ||
| } from './messages.test.mock'; | ||
|
|
||
| describe('Constants: Messages parseMessages()', () => { | ||
| const docLinksService = docLinksServiceMock.createStartContract(); | ||
|
|
||
| it('should parse valid job configuration messages', () => { | ||
| expect(parseMessages(basicValidJobMessages, docLinksService)).toStrictEqual([ | ||
| { | ||
| heading: 'Job ID format is valid', | ||
| id: 'job_id_valid', | ||
| status: 'success', | ||
| text: | ||
| 'Lowercase alphanumeric (a-z and 0-9) characters, hyphens or underscores, starts and ends with an alphanumeric character, and is no more than 64 characters long.', | ||
| url: | ||
| 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/ml-job-resource.html#ml-job-resource', | ||
| }, | ||
| { | ||
| heading: 'Detector functions', | ||
| id: 'detectors_function_not_empty', | ||
| status: 'success', | ||
| text: 'Presence of detector functions validated in all detectors.', | ||
| url: | ||
| 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/create-jobs.html#detectors', | ||
| }, | ||
| { | ||
| bucketSpan: '15m', | ||
| heading: 'Bucket span', | ||
| id: 'success_bucket_span', | ||
| status: 'success', | ||
| text: 'Format of "15m" is valid and passed validation checks.', | ||
| url: | ||
| 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/create-jobs.html#bucket-span', | ||
| }, | ||
| { | ||
| heading: 'Time range', | ||
| id: 'success_time_range', | ||
| status: 'success', | ||
| text: 'Valid and long enough to model patterns in the data.', | ||
| }, | ||
| { | ||
| heading: 'Model memory limit', | ||
| id: 'success_mml', | ||
| status: 'success', | ||
| text: 'Valid and within the estimated model memory limit.', | ||
| url: | ||
| 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/create-jobs.html#model-memory-limits', | ||
| }, | ||
| ]); | ||
| }); | ||
|
|
||
| it('should parse basic invalid job configuration messages', () => { | ||
| expect(parseMessages(basicInvalidJobMessages, docLinksService)).toStrictEqual([ | ||
| { | ||
| id: 'job_id_invalid', | ||
| status: 'error', | ||
| text: | ||
| 'Job ID is invalid. It can contain lowercase alphanumeric (a-z and 0-9) characters, hyphens or underscores and must start and end with an alphanumeric character.', | ||
| url: | ||
| 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/ml-job-resource.html#ml-job-resource', | ||
| }, | ||
| { | ||
| heading: 'Detector functions', | ||
| id: 'detectors_function_not_empty', | ||
| status: 'success', | ||
| text: 'Presence of detector functions validated in all detectors.', | ||
| url: | ||
| 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/create-jobs.html#detectors', | ||
| }, | ||
| { | ||
| bucketSpan: '15m', | ||
| heading: 'Bucket span', | ||
| id: 'bucket_span_valid', | ||
| status: 'success', | ||
| text: 'Format of "15m" is valid.', | ||
| url: | ||
| 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/ml-job-resource.html#ml-analysisconfig', | ||
| }, | ||
| { | ||
| id: 'skipped_extended_tests', | ||
| status: 'warning', | ||
| text: | ||
| 'Skipped additional checks because the basic requirements of the job configuration were not met.', | ||
| }, | ||
| ]); | ||
| }); | ||
|
|
||
| it('should parse non-basic issues messages', () => { | ||
| expect(parseMessages(nonBasicIssuesMessages, docLinksService)).toStrictEqual([ | ||
| { | ||
| heading: 'Job ID format is valid', | ||
| id: 'job_id_valid', | ||
| status: 'success', | ||
| text: | ||
| 'Lowercase alphanumeric (a-z and 0-9) characters, hyphens or underscores, starts and ends with an alphanumeric character, and is no more than 64 characters long.', | ||
| url: | ||
| 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/ml-job-resource.html#ml-job-resource', | ||
| }, | ||
| { | ||
| heading: 'Detector functions', | ||
| id: 'detectors_function_not_empty', | ||
| status: 'success', | ||
| text: 'Presence of detector functions validated in all detectors.', | ||
| url: | ||
| 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/create-jobs.html#detectors', | ||
| }, | ||
| { | ||
| id: 'cardinality_model_plot_high', | ||
| status: 'warning', | ||
| text: | ||
| 'The estimated cardinality of undefined of fields relevant to creating model plots might result in resource intensive jobs.', | ||
| }, | ||
| { | ||
| fieldName: 'order_id', | ||
| id: 'cardinality_partition_field', | ||
| status: 'warning', | ||
| text: | ||
| 'Cardinality of partition_field "order_id" is above 1000 and might result in high memory usage.', | ||
| url: | ||
| 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/create-jobs.html#cardinality', | ||
| }, | ||
| { | ||
| heading: 'Bucket span', | ||
| id: 'bucket_span_high', | ||
| status: 'info', | ||
| text: | ||
| 'Bucket span is 1 day or more. Be aware that days are considered as UTC days, not local days.', | ||
| url: | ||
| 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/create-jobs.html#bucket-span', | ||
| }, | ||
| { | ||
| bucketSpanCompareFactor: 25, | ||
| heading: 'Time range', | ||
| id: 'time_range_short', | ||
| minTimeSpanReadable: '2 hours', | ||
| status: 'warning', | ||
| text: | ||
| 'The selected or available time range might be too short. The recommended minimum time range should be at least 2 hours and 25 times the bucket span.', | ||
| }, | ||
| { | ||
| id: 'success_influencers', | ||
| status: 'success', | ||
| text: 'Influencer configuration passed the validation checks.', | ||
| url: | ||
| 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/ml-influencers.html', | ||
| }, | ||
| { | ||
| id: 'half_estimated_mml_greater_than_mml', | ||
| mml: '1MB', | ||
| status: 'warning', | ||
| text: | ||
| 'The specified model memory limit is less than half of the estimated model memory limit and will likely hit the hard limit.', | ||
| url: | ||
| 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/create-jobs.html#model-memory-limits', | ||
| }, | ||
| { | ||
| id: 'missing_summary_count_field_name', | ||
| status: 'error', | ||
| text: | ||
| 'A job configured with a datafeed with aggregations must set summary_count_field_name; use doc_count or suitable alternative.', | ||
| }, | ||
| ]); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.