-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Adds explain log rate spikes feature to the ML plugin #135948
[ML] Adds explain log rate spikes feature to the ML plugin #135948
Conversation
a923280
to
849e33a
Compare
Known issues:
|
65033a0
to
070f01f
Compare
Pinging @elastic/ml-ui (:ml) |
x-pack/plugins/aiops/public/components/full_time_range_selector/full_time_range_selector.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/aiops/public/components/full_time_range_selector/full_time_range_selector.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/aiops/public/components/full_time_range_selector/full_time_range_selector.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/aiops/public/components/full_time_range_selector/full_time_range_selector.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/aiops/public/components/full_time_range_selector/full_time_range_selector.tsx
Outdated
Show resolved
Hide resolved
...s/public/components/spike_analysis_table/get_failed_transactions_correlation_impact_label.ts
Outdated
Show resolved
Hide resolved
...plugins/aiops/public/components/full_time_range_selector/full_time_range_selector_service.ts
Outdated
Show resolved
Hide resolved
pagination={pagination} | ||
loading={loading} | ||
error={error} | ||
// sorting={sorting} |
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.
Have you left this in for a follow-up to add in row selection functionality?
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.
Yes 👍
pagination={pagination} | ||
loading={loading} | ||
error={error} | ||
// sorting={sorting} |
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.
The table should be sorted by p-value
, ascending, by default. My table doesn't look like it's sorted currently (the one in your screenshot does though).
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.
As discussed, sorting will be done in a follow-up
autoRefreshSelector?: boolean; | ||
} | ||
|
||
export const useTimefilter = ({ |
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.
Is the analysis re-run when the time range is changed? It looks like it currently always uses the full time range of the data view.
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.
In this PR the parameters to run the analysis are not passed on yet. Suggest to do that as part of the follow up that will add the brushes.
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.
OK, makes sense to do that in the brushes PR.
<ExplainLogRateSpikesLazy {...props} /> | ||
</LazyWrapper> | ||
); | ||
export const ExplainLogRateSpikes: FC<ExplainLogRateSpikesProps> = (props) => { |
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.
We should try to keep this component as small as possible, otherwise it will grow the loading bundle, ideally this file should not change at all. You could for example create a new component ExplainLogRateSpikesUrlStateWrapper
that gets consumed here as ExplainLogRateSpikesUrlStateWrapperLazy
. This new component would then contain ExplainLogRateSpikes
.
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.
Good call - updated in fd3cbb696ab1d3bc4f6c9cbcfd9f29124e986bf1
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 the UrlStateContextProvider
and related code (e.g. setUrlState
) also be moved into ExplainLogRateSpikesWrapperLazy
?
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.
Looking at the code again, it seems you moved it correctly to the inner component already 👍 but just missed removing it here?
@@ -4,15 +4,20 @@ | |||
* 2.0; you may not use this file except in compliance with the Elastic License | |||
* 2.0. | |||
*/ | |||
|
|||
// @ts-nocheck // remove |
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.
Are the changes in this file necessary? Since we hopefully copied everything over we need to aiops
we should aim for leaving data visualizer related files untouched.
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.
Nope, shouldn't be - good catch - removed in fd3cbb696ab1d3bc4f6c9cbcfd9f29124e986bf1 👍
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.
Looks good overall! Left a few comments about data-visualizer related comments as well as the structure of components regarding the lazy
setup.
const timeZone = getTimezone(uiSettings); | ||
|
||
return ( | ||
<div style={{ width: width ?? '100%' }} data-test-subj="dataVisualizerDocumentCountChart"> |
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.
Reference to dataVisualizer
should be changed to aiops
.
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 fd3cbb696ab1d3bc4f6c9cbcfd9f29124e986bf1
AiOpsStartDependencies & { | ||
storage: IStorageWrapper; | ||
}; | ||
export type DataVisualizerKibanaReactContextValue = KibanaReactContextValue<StartServices>; |
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.
Reference to DataVisualizer
should be changed to AiOps
.
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 fd3cbb696ab1d3bc4f6c9cbcfd9f29124e986bf1
status: number; | ||
} | ||
|
||
export interface DVResponseError { |
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.
This file uses a DV
prefix in several places, suggest to rename to AiOps
.
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 fd3cbb696ab1d3bc4f6c9cbcfd9f29124e986bf1
About the known issue with the refresh button: I will create a separate PR to fix this, this bug was already present before this PR. |
|
||
export const AIOPS_FROZEN_TIER_PREFERENCE = 'aiOps.frozenDataTierPreference'; | ||
|
||
export type DV = Partial<{ |
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.
Still some more DV
references in this file.
message: string; | ||
} | ||
|
||
export interface DVErrorObject { |
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.
Still some more DV
prefixes in this file.
…-ref HEAD~1..HEAD --fix'
ee27683
to
933ec26
Compare
@@ -25,6 +27,6 @@ const LazyWrapper: FC = ({ children }) => ( | |||
*/ | |||
export const ExplainLogRateSpikes: FC<ExplainLogRateSpikesProps> = (props) => ( | |||
<LazyWrapper> | |||
<ExplainLogRateSpikesLazy {...props} /> | |||
<ExplainLogRateSpikesWrapperLazy {...props} />{' '} |
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.
Guess the {' '}
part can be removed, might be a leftover from an auto-format gone wrong.
setPageIndex(index); | ||
setPageSize(size); | ||
|
||
// onTableChange(tableSettings); |
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 this commented code be removed?
|
||
const size = 0; | ||
const filterCriteria = buildBaseFilterCriteria(timeFieldName, earliestMs, latestMs, { | ||
match_all: {}, |
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.
Should this be using searchQuery
instead of match_all
? If not, would be good to clean up searchQuery or add a comment.
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.
Yep - I'll be adding search support in a follow up 👍
} | ||
} | ||
|
||
export function useOverallStats<TParams extends OverallStatsSearchStrategyParams>( |
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.
useOverallStats
doesn't make sense here in this context since you only need the document count. Suggestion to rename this file, this hook, and setOverallStats
.
autoRefreshSelector: true, | ||
}); | ||
|
||
const fieldStatsRequest: OverallStatsSearchStrategyParams | undefined = useMemo( |
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.
Suggestion to rename reference to fieldStats and OverallStats here since this seems to be a carry-over from DV.
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.
Renamed all suggested in 02c5863
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.
Tested latest changes and LGTM
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Summary
Part of #136265.
This is a follow up to the following PRs: Plugin Setup (#131317), Page Setup (#132121), API endpoint with license check (#135058, #135431), DualBrush component (#135318).
Adds initial UI for Explain log rate spikes view
For a follow up:
[ML] Explain log rate spikes: Search bar. #136571
[ML] Explain log rate spikes: Add field histograms to analysis result. #136295
[ML] Explain log rate spikes: Split main chart by selected field/value pair. #136712
p-value
descending by default[ML] Explain log rate spikes: adds table sorting #137110
Checklist