-
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] Replace APM error rate table with failed transactions correlations #108441
[ML] Replace APM error rate table with failed transactions correlations #108441
Conversation
bb8b23b
to
43d7a85
Compare
x-pack/plugins/apm/public/components/app/correlations/ml_failure_correlations.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/app/correlations/ml_failure_correlations.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/app/correlations/ml_failure_correlations_help_popover.tsx
Outdated
Show resolved
Hide resolved
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.
Had a first go at the code and added some comments. I see some of the naming in files/vars still uses the now outdated failure
terms. The up to date name of the feature is Failed transactions correlations
. Please have a look at its usage across the PR.
import type { SelectedSignificantTerm } from '../../../../common/search_strategies/correlations/types'; | ||
|
||
export type { SelectedSignificantTerm }; |
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.
Not sure this is necessary? Can the other places that use this type also import from common
?
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.
Fixed here f4ecc66
@@ -170,6 +170,7 @@ export function ErrorCorrelations({ onClose }: Props) { | |||
'xpack.apm.correlations.error.percentageColumnName', | |||
{ defaultMessage: '% of failed transactions' } | |||
)} | |||
// @ts-expect-error: this file to be removed |
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.
Maybe we can remove this file as part of this PR already?
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.
Deleted here e70878c
@@ -0,0 +1,410 @@ | |||
/* |
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.
Suggest to name the file and components without ml
prefix (failure_correlations.tsx
). We kept the prefix around for 7.14 because the old code was still around. With the previous components planned to go for 7.15 we no longer will need the prefixes.
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 here 1554436
values: FailureCorrelationValue[]; | ||
} | ||
|
||
export function MlFailureCorrelations({ onClose }: 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.
Suggest to name FailureCorrelations
instead of MlFailureCorrelations
.
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 here 1554436
{ | ||
...{ | ||
...{ | ||
environment, | ||
kuery, | ||
serviceName, | ||
transactionName, | ||
transactionType, | ||
start, | ||
end, | ||
}, | ||
}, | ||
}, |
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 like this is unnecessarly deeply nested. I think it could just be the most inner object.
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 here 1554436
import { FailureCorrelationImpactThreshold } from '../../../../../common/search_strategies/failure_correlations/types'; | ||
import { FAILURE_CORRELATION_IMPACT_THRESHOLD } from '../../../../../common/search_strategies/failure_correlations/constants'; | ||
|
||
export function getFailureCorrelationImpactLabel( |
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.
Quick win? Would be great to cover this with jest tests as part of this PR.
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.
Added unit tests for this here c6940c1
@@ -11,7 +11,7 @@ import { euiStyled } from '../../../../../../../src/plugins/kibana_react/common' | |||
import { Maybe } from '../../../../typings/common'; | |||
|
|||
interface Props { | |||
items: Array<Maybe<React.ReactElement>>; | |||
items: Array<Maybe<React.ReactElement | string>>; |
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.
Not sure we should change this component which is used in other places too as part of this PR. Can you try to adapt the props we pass in? E.g. change 'text'
to <>{text}</>
.
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 here 1554436
try { | ||
const results = await Promise.allSettled( | ||
batches[i].map((fieldName) => | ||
fetchFailureCorrelationPValues(esClient, params!, fieldName) |
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.
Suggest to try to get rid of the !
.
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 here 1554436
score: number; | ||
}>).buckets.map((b) => { | ||
const score = b.score; | ||
const normalizedScore = |
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.
Would be great to have a comment here that describes what this is trying to achieve based on TomV's description of the approach
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 here 1554436
x-pack/plugins/apm/server/plugin.ts
Outdated
) | ||
); | ||
|
||
// Register APM error correlations strategy |
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.
// Register APM error correlations strategy | |
// Register APM failed transactions correlations correlations strategy |
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 here 1554436
Pinging @elastic/ml-ui (:ml) |
Pinging @elastic/apm-ui (Team:apm) |
….com/qn895/kibana into ml-apm-failure-correlation-in-flyout
services: { data }, | ||
} = useKibana<ApmPluginStartDeps>(); | ||
|
||
const [error, setError] = useState<Error>(); |
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.
For the similar code for latency correlations we decided to reduce the number of required state handlers and maintain a single state object, you can see how it was done here: 1284687
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.
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. A couple of changes I noticed are needed.
}, | ||
}, | ||
]; | ||
const tableColumns: Array<EuiBasicTableColumn<T>> = columns ?? []; |
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.
If columns
is already a required prop with this type do we need this assignment or the ?? []
at 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.
Updated here bcec466
button={ | ||
<HelpPopoverButton | ||
onClick={() => { | ||
setIsPopoverOpen(!isPopoverOpen); |
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.
You'll want to use the function form of this to ensure you have the correct state:
setIsPopoverOpen(!isPopoverOpen); | |
setIsPopoverOpen((prevIsPopoverOpen) => !prevIsPopoverOpen); |
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 here bcec466
async function fetchErrorCorrelations() { | ||
let params: SearchServiceFetchParams = { | ||
...searchServiceParams, | ||
index: 'apm-*', |
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 shouldn't be hard-coding this index. It looks like we're not below, so I think we should be doing the same here.
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 was originally just a default fallback, but you're right it's better to not hard-code at all. Updated here bcec466
I'm not seeing any data on this tab when I run this locally against edge-oblt. Is there anywhere on here I should be able to see data? I wasn't expecting it to empty everywhere but that's what it looks like. |
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.
LGTM ⚡
Did some re-arrangement here and moved the Beta badge from the tab title into the tab content so it's more inline with Latency correlations tab Screen.Recording.2021-08-17.at.13.17.30.movAlso changed to show p values up to 3 significant figures instead of labelling 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.
Tested and Latest changes LGTM
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: cc @qn895 |
…ns (elastic#108441) * [ML] Refactor with new table * [ML] Fix types, rename var * [ML] Remove duplicate action columns * [ML] Finish renaming for consistency * [ML] Add failure correlations help popover * [ML] Add failure correlations help popover * [ML] Extend correlation help * Update message * [ML] Delete old legacy correlations pages * [ML] Address comments, rename * [ML] Revert deletion of latency_correlations.tsx * [ML] Add unit test for getFailedTransactionsCorrelationImpactLabel * [ML] Rename & fix types * [ML] Fix logic to note include 0.02 threshold * [ML] Refactor to use state handler * [ML] Fix hardcoded index, columns, popover * [ML] Replace failed transaction tab * [ML] Fix unused translations * [ML] Delete empty files * [ML] Move beta badge to be inside tab content Co-authored-by: lcawl <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
…ns (#108441) (#109000) * [ML] Refactor with new table * [ML] Fix types, rename var * [ML] Remove duplicate action columns * [ML] Finish renaming for consistency * [ML] Add failure correlations help popover * [ML] Add failure correlations help popover * [ML] Extend correlation help * Update message * [ML] Delete old legacy correlations pages * [ML] Address comments, rename * [ML] Revert deletion of latency_correlations.tsx * [ML] Add unit test for getFailedTransactionsCorrelationImpactLabel * [ML] Rename & fix types * [ML] Fix logic to note include 0.02 threshold * [ML] Refactor to use state handler * [ML] Fix hardcoded index, columns, popover * [ML] Replace failed transaction tab * [ML] Fix unused translations * [ML] Delete empty files * [ML] Move beta badge to be inside tab content Co-authored-by: lcawl <[email protected]> Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Quynh Nguyen <[email protected]> Co-authored-by: lcawl <[email protected]>
Summary
This PR replaces the current APM error rate table with ML's new failure correlation algorithm
Screen.Recording.2021-08-17.at.10.39.22.mov
Changes include:
Failing transactions -> Failed transactions
(Note that the flyout to be removed in [ML] Move APM Latency Correlations from flyout to transactions page. #107266)Follow ups:
Checklist
Delete any items that are not applicable to this PR.