Skip to content
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] Show at least one correlation value and consolidate correlations columns #126683

Merged

Conversation

qn895
Copy link
Member

@qn895 qn895 commented Mar 2, 2022

Summary

This PR updates it so that it will show at least one fall back correlation value when no other significant correlation is found. These will show up as 'Very low'
Screen Shot 2022-03-01 at 21 22 48

It also adds an impact column to the Latency tab, as well as converting the progress bar in Failed transactions tab to showing numerical value. This makes it consistent across both tabs.

Screen Shot 2022-03-02 at 14 53 24

Screen Shot 2022-03-03 at 12 27 18

### Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@qn895 qn895 self-assigned this Mar 2, 2022
@qn895 qn895 added :ml apm:ml Integration between APM and ML release_note:enhancement v8.2.0 labels Mar 2, 2022
{i18n.translate(
'xpack.apm.correlations.failedTransactions.correlationsTable.impactLabel',
{
defaultMessage: 'Impact',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to add an info tooltip for the Impact column, and one for the Score column on the failed transactions tab, if only to say what the range of values is.

Copy link
Contributor

@lcawl lcawl Mar 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "impact" seems pretty straight-forward to me and is already mentioned in the popover help for these pages, so IMO a tooltip there isn't necessary.

However, I think it makes sense to have a tooltip for "score". Can we base it on what we have
for "correlation"?:

'The correlation score [0-1] of an attribute; the greater the score, the more an attribute increases latency.',

For example: "The score [0-1] of an attribute; the greater the score, the more an attribute contributes to failed transactions." or "more likely it is that an attribute..."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here abb1e2a

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gave this a test against the apm-correlations-eden and apm-correlations-antifraud-hist data sets and overall looks good. I couldn't find any transactions which show fallback results in the failed transaction tab, but did for the Latency tab, and the consistent columns work well I think.

@qn895 qn895 requested a review from walterra March 3, 2022 16:04
@qn895 qn895 marked this pull request as ready for review March 3, 2022 16:04
@qn895 qn895 requested a review from a team as a code owner March 3, 2022 16:04
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@qn895 qn895 requested a review from lcawl March 3, 2022 16:42
@botelastic botelastic bot added the Team:APM All issues that need APM UI Team support label Mar 3, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

@qn895
Copy link
Member Author

qn895 commented Mar 7, 2022

@elasticmachine merge upstream

[{ fieldName, fieldValue }]
);

if (typeof fallbackResult === 'object' && fallbackResult !== null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afaict from the type annotation fallbackResult is LatencyCorrelation | undefined. In other words: it's either an object, or it's undefined. In that case, isn't this enough?

Suggested change
if (typeof fallbackResult === 'object' && fallbackResult !== null) {
if (fallbackResult) {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here 9f57ca3


if (typeof fallbackResult === 'object' && fallbackResult !== null) {
fallbackResult = {
...(fallbackResult as LatencyCorrelation),
Copy link
Member

@sorenlouv sorenlouv Mar 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be necessary. The if clause should act as a typeguard and narrow the type from optional to LatencyCorrelation

Suggested change
...(fallbackResult as LatencyCorrelation),
...fallbackResult,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here 9f57ca3

Comment on lines 83 to 99
fulfilled.forEach((d: LatencyCorrelation | undefined) => {
if (d === undefined) return;
if (Array.isArray(d.histogram)) {
latencyCorrelations.push(d);
} else {
if (!fallbackResult) {
fallbackResult = d;
} else {
if (
d.ksTest > fallbackResult.ksTest &&
d.correlation > fallbackResult.correlation
) {
fallbackResult = d;
}
}
}
});
Copy link
Member

@sorenlouv sorenlouv Mar 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any possibility of rewriting this to using filter and map? Immutable code is often easier to reason about and less error prone.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here 9f57ca3

Comment on lines +229 to +234
setResponse({
...responseUpdate,
fallbackResult,
loaded: LOADED_DONE,
isRunning: false,
});
Copy link
Member

@sorenlouv sorenlouv Mar 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we are no longer using kibana search strategies, would it be possible to use useFetcher for loading data or is that still blocked by something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in Slack, since this might be out of scope of the PR, let's table this for now and revisit in the future for a better implementation.

Copy link
Member

@sorenlouv sorenlouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments. Overall lgtm

@kibana-ci
Copy link
Collaborator

kibana-ci commented Mar 15, 2022

💔 Build Failed

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 2.7MB 2.7MB +1.6KB
Unknown metric groups

ESLint disabled in files

id before after diff
apm 15 14 -1
uptime 7 6 -1
total -2

ESLint disabled line counts

id before after diff
apm 88 85 -3
uptime 48 42 -6
total -9

Total ESLint disabled count

id before after diff
apm 103 99 -4
uptime 55 48 -7
total -11

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @qn895

Copy link
Contributor

@peteharverson peteharverson left a 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

@qn895
Copy link
Member Author

qn895 commented Mar 18, 2022

@elasticmachine merge upstream

@qn895
Copy link
Member Author

qn895 commented Mar 21, 2022

@elasticmachine merge upstream

@qn895 qn895 enabled auto-merge (squash) March 21, 2022 15:09
@qn895 qn895 merged commit 3a4c6de into elastic:main Mar 21, 2022
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 2.9MB 2.9MB +1.6KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @qn895

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 23, 2022
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 126683 or prevent reminders by adding the backport:skip label.

@peteharverson peteharverson added backport:skip This commit does not require backporting and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:ml Integration between APM and ML backport:skip This commit does not require backporting :ml release_note:enhancement Team:APM All issues that need APM UI Team support v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants