-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Logs UI] Add dataset-specific categorization warnings #75351
Merged
weltenwort
merged 29 commits into
elastic:master
from
weltenwort:logs-ui-per-partition-categorization-warnings
Sep 24, 2020
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
f7adbd2
add category quality route (WIP)
weltenwort af7158a
Merge branch 'master' into logs-ui-per-partition-categorization-warnings
weltenwort 6330a27
create library function for category quality route (WIP)
weltenwort 7af8b05
Merge branch 'master' into logs-ui-per-partition-categorization-warnings
weltenwort 16e1439
rename from category quality to category stats
weltenwort b3f0a40
Add http route types and handler
weltenwort a4e4c8f
Merge branch 'master' into logs-ui-per-partition-categorization-warnings
weltenwort 058c52e
Merge branch 'master' into logs-ui-per-partition-categorization-warnings
weltenwort 0d9e9b0
Load and display partitioned category warnings
weltenwort 07dce3f
Show dataset names in category warnings
weltenwort 8f8b6f2
Merge branch 'master' into logs-ui-per-partition-categorization-warnings
weltenwort b613bd7
Group warnings by job
weltenwort e5e7a5d
Merge branch 'master' into logs-ui-per-partition-categorization-warnings
weltenwort 453bbc1
Make the warning reason list responsive
weltenwort b69d4b2
Move some types to common folder
weltenwort f0ba243
Display the dataset warnings in the setup screen
weltenwort 9f9d57a
Show tooltip for index-level quality warnings
weltenwort 1a09822
Merge branch 'master' into logs-ui-per-partition-categorization-warnings
weltenwort 6471da1
Use common setup flyout on categories tab
weltenwort 5a361bb
Reset partitioned warnings when overall warning disappears
weltenwort b096a73
Fix translations
weltenwort d11d530
Merge branch 'master' into logs-ui-per-partition-categorization-warnings
weltenwort 0908ab9
Fix API type definition
afgomez 404227e
Tweak grouping of warning messages
afgomez 370f85a
Merge branch 'master' into logs-ui-per-partition-categorization-warnings
weltenwort c28a749
Use dt for dataset groups to avoid margin problems
weltenwort 36bdcbc
Add key to Fragment
weltenwort 7a97d24
Merge branch 'master' into logs-ui-per-partition-categorization-warnings
weltenwort 87ca95e
Inject `fetch` instead of accessing the singleton
weltenwort 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 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
72 changes: 72 additions & 0 deletions
72
...k/plugins/infra/common/http_api/log_analysis/results/log_entry_category_datasets_stats.ts
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,72 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import * as rt from 'io-ts'; | ||
|
||
import { timeRangeRT, routeTimingMetadataRT } from '../../shared'; | ||
|
||
export const LOG_ANALYSIS_GET_LATEST_LOG_ENTRY_CATEGORY_DATASETS_STATS_PATH = | ||
'/api/infra/log_analysis/results/latest_log_entry_category_datasets_stats'; | ||
|
||
const categorizerStatusRT = rt.keyof({ | ||
ok: null, | ||
warn: null, | ||
}); | ||
|
||
export type CategorizerStatus = rt.TypeOf<typeof categorizerStatusRT>; | ||
|
||
/** | ||
* request | ||
*/ | ||
|
||
export const getLatestLogEntryCategoryDatasetsStatsRequestPayloadRT = rt.type({ | ||
data: rt.type({ | ||
// the ids of the categorization jobs | ||
jobIds: rt.array(rt.string), | ||
// the time range to fetch the category datasets stats for | ||
timeRange: timeRangeRT, | ||
// the categorizer statuses to include stats for, empty means all | ||
includeCategorizerStatuses: rt.array(categorizerStatusRT), | ||
}), | ||
}); | ||
|
||
export type GetLatestLogEntryCategoryDatasetsStatsRequestPayload = rt.TypeOf< | ||
typeof getLatestLogEntryCategoryDatasetsStatsRequestPayloadRT | ||
>; | ||
|
||
/** | ||
* response | ||
*/ | ||
|
||
const logEntryCategoriesDatasetStatsRT = rt.type({ | ||
categorization_status: categorizerStatusRT, | ||
categorized_doc_count: rt.number, | ||
dataset: rt.string, | ||
dead_category_count: rt.number, | ||
failed_category_count: rt.number, | ||
frequent_category_count: rt.number, | ||
job_id: rt.string, | ||
log_time: rt.number, | ||
rare_category_count: rt.number, | ||
total_category_count: rt.number, | ||
}); | ||
|
||
export type LogEntryCategoriesDatasetStats = rt.TypeOf<typeof logEntryCategoriesDatasetStatsRT>; | ||
|
||
export const getLatestLogEntryCategoryDatasetsStatsSuccessResponsePayloadRT = rt.intersection([ | ||
rt.type({ | ||
data: rt.type({ | ||
datasetStats: rt.array(logEntryCategoriesDatasetStatsRT), | ||
}), | ||
}), | ||
rt.partial({ | ||
timing: routeTimingMetadataRT, | ||
}), | ||
]); | ||
|
||
export type GetLatestLogEntryCategoryDatasetsStatsSuccessResponsePayload = rt.TypeOf< | ||
typeof getLatestLogEntryCategoryDatasetsStatsSuccessResponsePayloadRT | ||
>; |
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
42 changes: 42 additions & 0 deletions
42
x-pack/plugins/infra/common/log_analysis/log_analysis_quality.ts
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,42 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
interface ManyCategoriesWarningReason { | ||
type: 'manyCategories'; | ||
categoriesDocumentRatio: number; | ||
} | ||
interface ManyDeadCategoriesWarningReason { | ||
type: 'manyDeadCategories'; | ||
deadCategoriesRatio: number; | ||
} | ||
interface ManyRareCategoriesWarningReason { | ||
type: 'manyRareCategories'; | ||
rareCategoriesRatio: number; | ||
} | ||
interface NoFrequentCategoriesWarningReason { | ||
type: 'noFrequentCategories'; | ||
} | ||
interface SingleCategoryWarningReason { | ||
type: 'singleCategory'; | ||
} | ||
|
||
export type CategoryQualityWarningReason = | ||
| ManyCategoriesWarningReason | ||
| ManyDeadCategoriesWarningReason | ||
| ManyRareCategoriesWarningReason | ||
| NoFrequentCategoriesWarningReason | ||
| SingleCategoryWarningReason; | ||
|
||
export type CategoryQualityWarningReasonType = CategoryQualityWarningReason['type']; | ||
|
||
export interface CategoryQualityWarning { | ||
type: 'categoryQualityWarning'; | ||
jobId: string; | ||
dataset: string; | ||
reasons: CategoryQualityWarningReason[]; | ||
} | ||
|
||
export type QualityWarning = CategoryQualityWarning; | ||
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
68 changes: 68 additions & 0 deletions
68
...fra/public/components/logging/log_analysis_job_status/quality_warning_notices.stories.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,68 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { action } from '@storybook/addon-actions'; | ||
import { storiesOf } from '@storybook/react'; | ||
import React from 'react'; | ||
import { EuiThemeProvider } from '../../../../../observability/public'; | ||
import { QualityWarning } from '../../../../common/log_analysis'; | ||
import { CategoryQualityWarnings } from './quality_warning_notices'; | ||
|
||
storiesOf('infra/logAnalysis/CategoryQualityWarnings', module) | ||
weltenwort marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.addDecorator((renderStory) => <EuiThemeProvider>{renderStory()}</EuiThemeProvider>) | ||
.add('Partitioned warnings', () => { | ||
return ( | ||
<CategoryQualityWarnings | ||
hasSetupCapabilities={true} | ||
onRecreateMlJob={action('on-recreate-ml-job')} | ||
qualityWarnings={partitionedQualityWarnings} | ||
/> | ||
); | ||
}) | ||
.add('Unpartitioned warnings', () => { | ||
return ( | ||
<CategoryQualityWarnings | ||
hasSetupCapabilities={true} | ||
onRecreateMlJob={action('on-recreate-ml-job')} | ||
qualityWarnings={unpartitionedQualityWarnings} | ||
/> | ||
); | ||
}); | ||
|
||
const partitionedQualityWarnings: QualityWarning[] = [ | ||
{ | ||
type: 'categoryQualityWarning', | ||
jobId: 'theMlJobId', | ||
dataset: 'first.dataset', | ||
reasons: [ | ||
{ type: 'singleCategory' }, | ||
{ type: 'manyRareCategories', rareCategoriesRatio: 0.95 }, | ||
{ type: 'manyCategories', categoriesDocumentRatio: 0.7 }, | ||
], | ||
}, | ||
{ | ||
type: 'categoryQualityWarning', | ||
jobId: 'theMlJobId', | ||
dataset: 'second.dataset', | ||
reasons: [ | ||
{ type: 'noFrequentCategories' }, | ||
{ type: 'manyDeadCategories', deadCategoriesRatio: 0.7 }, | ||
], | ||
}, | ||
]; | ||
|
||
const unpartitionedQualityWarnings: QualityWarning[] = [ | ||
{ | ||
type: 'categoryQualityWarning', | ||
jobId: 'theMlJobId', | ||
dataset: '', | ||
reasons: [ | ||
{ type: 'singleCategory' }, | ||
{ type: 'manyRareCategories', rareCategoriesRatio: 0.95 }, | ||
{ type: 'manyCategories', categoriesDocumentRatio: 0.7 }, | ||
], | ||
}, | ||
]; |
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.
Was there a reason to keep this alias? Otherwise I think we can safely remove it.
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.
Well, the thinking was that the
CategoryQualityWarning
is just a special case. I wanted to make that clear in the consuming code that it shouldn't rely too strictly on the fact that no other warnings have been implemented.Other warnings could be that buckets have been skipped due to delay, which can happen in any anomaly detection job.