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
[ML] Creates categorization job from pattern analysis #170567
Merged
jgowdyelastic
merged 42 commits into
elastic:main
from
jgowdyelastic:create-categorization-job-from-pattern-analysis
Nov 21, 2023
Merged
Changes from 34 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
fc7bb19
[ML] Create categorization job from pattern analysis
jgowdyelastic 1425e01
Merge branch 'main' into create-categorization-job-from-pattern-analysis
jgowdyelastic 7872002
Merge branch 'main' into create-categorization-job-from-pattern-analysis
jgowdyelastic 00f5a00
Merge branch 'main' into create-categorization-job-from-pattern-analysis
jgowdyelastic 53e10c5
adding link to wizard
jgowdyelastic 8fc8697
fixing per partition
jgowdyelastic 080643a
Merge branch 'main' into create-categorization-job-from-pattern-analysis
jgowdyelastic ebfe734
better validation
jgowdyelastic 7c0cf71
fix dependency cache issue
jgowdyelastic f48b6c3
passing stop on warn to wizard
jgowdyelastic 54017c1
types refactor
jgowdyelastic ff2f4e9
making uiActions optional
jgowdyelastic 073000e
moving button to sepatate component
jgowdyelastic 408d464
moving ui action to package
jgowdyelastic 8625443
Merge branch 'main' into create-categorization-job-from-pattern-analysis
jgowdyelastic fd08c9a
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine f99fe22
[CI] Auto-commit changed files from 'node scripts/lint_packages --fix'
kibanamachine f9e718f
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine dacbecb
Merge branch 'main' into create-categorization-job-from-pattern-analysis
jgowdyelastic 3d8b6f3
translations
jgowdyelastic 583f366
Add machine learning icon
jgowdyelastic 4cb5543
flyout refactor
jgowdyelastic bfa89a9
using correct time range for results
jgowdyelastic 156b2df
Merge branch 'main' into create-categorization-job-from-pattern-analysis
jgowdyelastic 4c97a64
private methods
jgowdyelastic 9142c26
Merge branch 'main' into create-categorization-job-from-pattern-analysis
jgowdyelastic ce5a26d
optional dashboard
jgowdyelastic 31b87c1
clean up
jgowdyelastic f5d3f76
adjusting gutter size
jgowdyelastic 18f7f7a
Merge remote-tracking branch 'origin/main' into create-categorization…
jgowdyelastic be97917
fix after merge with main
jgowdyelastic a1eb0c8
updating trigger text
jgowdyelastic b6359b0
Merge branch 'main' into create-categorization-job-from-pattern-analysis
jgowdyelastic 7802419
Merge branch 'main' into create-categorization-job-from-pattern-analysis
jgowdyelastic 1afac7e
adding partition field to influencers
jgowdyelastic 3fddf0b
Merge branch 'main' into create-categorization-job-from-pattern-analysis
jgowdyelastic d32017d
improving rison parsing
jgowdyelastic 055a53b
removing question mark
jgowdyelastic 7eaabbd
Merge branch 'main' into create-categorization-job-from-pattern-analysis
kibanamachine 8451388
Merge remote-tracking branch 'origin/main' into create-categorization…
jgowdyelastic aa2cf7c
Merge branch 'create-categorization-job-from-pattern-analysis' of git…
jgowdyelastic 791a0d6
Merge branch 'main' into create-categorization-job-from-pattern-analysis
jgowdyelastic File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains 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 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 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 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 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 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 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 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,3 @@ | ||
# @kbn/ml-ui-actions | ||
|
||
Empty package generated by @kbn/generate |
This file contains 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,12 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export { | ||
CREATE_PATTERN_ANALYSIS_TO_ML_AD_JOB_ACTION, | ||
CREATE_PATTERN_ANALYSIS_TO_ML_AD_JOB_TRIGGER, | ||
type CreateCategorizationADJobContext, | ||
} from './src/ui_actions'; |
This file contains 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,12 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
module.exports = { | ||
preset: '@kbn/test/jest_node', | ||
rootDir: '../../../..', | ||
roots: ['<rootDir>/x-pack/packages/ml/ui_actions'], | ||
}; |
This file contains 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,5 @@ | ||
{ | ||
"type": "shared-common", | ||
"id": "@kbn/ml-ui-actions", | ||
"owner": "@elastic/ml-ui" | ||
} |
This file contains 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,6 @@ | ||
{ | ||
"name": "@kbn/ml-ui-actions", | ||
"private": true, | ||
"version": "1.0.0", | ||
"license": "Elastic License 2.0" | ||
} |
This file contains 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,22 @@ | ||
/* | ||
* 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 type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; | ||
import type { DataView, DataViewField } from '@kbn/data-views-plugin/common'; | ||
import type { TimeRange } from '@kbn/es-query'; | ||
|
||
export interface CreateCategorizationADJobContext { | ||
field: DataViewField; | ||
dataView: DataView; | ||
query: QueryDslQueryContainer; | ||
timeRange: TimeRange; | ||
} | ||
|
||
export const CREATE_PATTERN_ANALYSIS_TO_ML_AD_JOB_ACTION = 'createMLADCategorizationJobAction'; | ||
|
||
export const CREATE_PATTERN_ANALYSIS_TO_ML_AD_JOB_TRIGGER = | ||
'CREATE_PATTERN_ANALYSIS_TO_ML_AD_JOB_TRIGGER'; |
This file contains 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,20 @@ | ||
{ | ||
"extends": "../../../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"outDir": "target/types", | ||
"types": [ | ||
"jest", | ||
"node" | ||
] | ||
}, | ||
"include": [ | ||
"**/*.ts", | ||
], | ||
"exclude": [ | ||
"target/**/*" | ||
], | ||
"kbn_references": [ | ||
"@kbn/data-views-plugin", | ||
"@kbn/es-query", | ||
] | ||
} |
76 changes: 76 additions & 0 deletions
76
x-pack/plugins/aiops/public/components/log_categorization/create_categorization_job.tsx
This file contains 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,76 @@ | ||
/* | ||
* 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 React, { FC } from 'react'; | ||
|
||
import moment from 'moment'; | ||
import { EuiButtonEmpty } from '@elastic/eui'; | ||
import type { DataViewField, DataView } from '@kbn/data-views-plugin/common'; | ||
import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; | ||
import { | ||
CREATE_PATTERN_ANALYSIS_TO_ML_AD_JOB_TRIGGER, | ||
type CreateCategorizationADJobContext, | ||
} from '@kbn/ml-ui-actions'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
|
||
import { useAiopsAppContext } from '../../hooks/use_aiops_app_context'; | ||
|
||
interface Props { | ||
dataView: DataView; | ||
field: DataViewField; | ||
query: QueryDslQueryContainer; | ||
earliest: number | undefined; | ||
latest: number | undefined; | ||
} | ||
|
||
export const CreateCategorizationJobButton: FC<Props> = ({ | ||
dataView, | ||
field, | ||
query, | ||
earliest, | ||
latest, | ||
}) => { | ||
const { | ||
uiActions, | ||
application: { capabilities }, | ||
} = useAiopsAppContext(); | ||
|
||
const createADJob = () => { | ||
if (uiActions === undefined) { | ||
return; | ||
} | ||
|
||
const triggerOptions: CreateCategorizationADJobContext = { | ||
dataView, | ||
field, | ||
query, | ||
timeRange: { from: moment(earliest).toISOString(), to: moment(latest).toISOString() }, | ||
}; | ||
uiActions.getTrigger(CREATE_PATTERN_ANALYSIS_TO_ML_AD_JOB_TRIGGER).exec(triggerOptions); | ||
}; | ||
|
||
if (uiActions === undefined || capabilities.ml.canCreateJob === false) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
<EuiButtonEmpty | ||
data-test-subj="aiopsLogCategorizationFlyoutAdJobButton" | ||
onClick={() => createADJob()} | ||
flush="left" | ||
iconSide="left" | ||
iconType={'machineLearningApp'} | ||
> | ||
<FormattedMessage | ||
id="xpack.aiops.categorizeFlyout.findAnomalies" | ||
defaultMessage="Find anomalies in patterns" | ||
/> | ||
</EuiButtonEmpty> | ||
</> | ||
); | ||
}; |
This file contains 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 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 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 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 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 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 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 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 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 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 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you just pass in
createADJob
here without creating a wrapper function?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in d32017d