-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] [AIOps] Log Rate Analysis: Adds support to restore baseline/devi…
…ation from url state on page refresh. (#171398) Support to restore baseline/deviation time ranges from url state on full page refresh. Also updates functional tests to include a full page refresh after the first analysis run for each dataset.
- Loading branch information
Showing
12 changed files
with
161 additions
and
53 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
26 changes: 26 additions & 0 deletions
26
x-pack/plugins/aiops/public/application/url_state/log_pattern_analysis.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,26 @@ | ||
/* | ||
* 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 { getDefaultAiOpsListState, type AiOpsFullIndexBasedAppState } from './common'; | ||
|
||
export interface LogCategorizationPageUrlState { | ||
pageKey: 'logCategorization'; | ||
pageUrlState: LogCategorizationAppState; | ||
} | ||
|
||
export interface LogCategorizationAppState extends AiOpsFullIndexBasedAppState { | ||
field: string | undefined; | ||
} | ||
|
||
export const getDefaultLogCategorizationAppState = ( | ||
overrides?: Partial<LogCategorizationAppState> | ||
): LogCategorizationAppState => { | ||
return { | ||
field: undefined, | ||
...getDefaultAiOpsListState(overrides), | ||
}; | ||
}; |
66 changes: 66 additions & 0 deletions
66
x-pack/plugins/aiops/public/application/url_state/log_rate_analysis.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,66 @@ | ||
/* | ||
* 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 { WindowParameters } from '@kbn/aiops-utils'; | ||
|
||
import { getDefaultAiOpsListState, type AiOpsFullIndexBasedAppState } from './common'; | ||
|
||
export interface LogRateAnalysisPageUrlState { | ||
pageKey: 'logRateAnalysis'; | ||
pageUrlState: LogRateAnalysisAppState; | ||
} | ||
/** | ||
* To avoid long urls, we store the window parameters in the url state not with | ||
* their full parameters names but with abbrevations. `windowParametersToAppState` and | ||
* `appStateToWindowParameters` are used to transform the data structure. | ||
*/ | ||
export interface LogRateAnalysisAppState extends AiOpsFullIndexBasedAppState { | ||
/** Window parameters */ | ||
wp?: { | ||
/** Baseline minimum value */ | ||
bMin: number; | ||
/** Baseline maximum value */ | ||
bMax: number; | ||
/** Deviation minimum value */ | ||
dMin: number; | ||
/** Deviation maximum value */ | ||
dMax: number; | ||
}; | ||
} | ||
|
||
/** | ||
* Transforms a full window parameters object to the abbreviated url state version. | ||
*/ | ||
export const windowParametersToAppState = (wp?: WindowParameters): LogRateAnalysisAppState['wp'] => | ||
wp && { | ||
bMin: wp.baselineMin, | ||
bMax: wp.baselineMax, | ||
dMin: wp.deviationMin, | ||
dMax: wp.deviationMax, | ||
}; | ||
|
||
/** | ||
* Transforms an abbreviated url state version of window parameters to its full version. | ||
*/ | ||
export const appStateToWindowParameters = ( | ||
wp: LogRateAnalysisAppState['wp'] | ||
): WindowParameters | undefined => | ||
wp && { | ||
baselineMin: wp.bMin, | ||
baselineMax: wp.bMax, | ||
deviationMin: wp.dMin, | ||
deviationMax: wp.dMax, | ||
}; | ||
|
||
export const getDefaultLogRateAnalysisAppState = ( | ||
overrides?: Partial<LogRateAnalysisAppState> | ||
): LogRateAnalysisAppState => { | ||
return { | ||
wp: undefined, | ||
...getDefaultAiOpsListState(overrides), | ||
}; | ||
}; |
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