forked from elastic/kibana
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Log pattern analysis field validation (elastic#162319)
Uses the recently created [category validation package](elastic#161261) to perform validation on the field selected for pattern analysis. If the field is considered unsuitable for categorization, a warning callout is displayed which lists the reasons it is unsuitable. If the field is suitable, no callout is displayed. Other changes: - Adds the selected field to the URL state, so it is remembered on page refresh. - If no field is in the URL, it will look for a field called `message` in the data view and auto select it. - renames the ML route `/jobs/categorization_field_examples` to `/jobs/categorization_field_validation` as it is a more accurate name and it's consistent with the newly added route in AIOPs. **Log Pattern Analysis page in ML** ![image](https://github.com/elastic/kibana/assets/22172091/c0dfda8b-bc34-48b7-9e71-8bae9e65bdf3) **Log Pattern Analysis flyout in Discover** ![image](https://github.com/elastic/kibana/assets/22172091/b4d251f3-bae6-424f-9891-bda57ba1673d) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
acc869b
commit d862481
Showing
32 changed files
with
544 additions
and
142 deletions.
There are no files selected for viewing
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
44 changes: 44 additions & 0 deletions
44
x-pack/plugins/aiops/public/components/log_categorization/category_validation_callout.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,44 @@ | ||
/* | ||
* 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 { | ||
FieldValidationResults, | ||
CATEGORY_EXAMPLES_VALIDATION_STATUS, | ||
} from '@kbn/ml-category-validator'; | ||
|
||
import { EuiCallOut } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
|
||
interface Props { | ||
validationResults: FieldValidationResults | null; | ||
} | ||
|
||
export const FieldValidationCallout: FC<Props> = ({ validationResults }) => { | ||
if (validationResults === null) { | ||
return null; | ||
} | ||
|
||
if (validationResults.overallValidStatus === CATEGORY_EXAMPLES_VALIDATION_STATUS.VALID) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<EuiCallOut | ||
color="warning" | ||
title={i18n.translate('xpack.aiops.logCategorization.fieldValidationTitle', { | ||
defaultMessage: 'The selected field is possibly not suitable for pattern analysis', | ||
})} | ||
> | ||
{validationResults.validationChecks | ||
.filter((check) => check.valid !== CATEGORY_EXAMPLES_VALIDATION_STATUS.VALID) | ||
.map((check) => ( | ||
<div key={check.id}>{check.message}</div> | ||
))} | ||
</EuiCallOut> | ||
); | ||
}; |
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.