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] Improves Data drift time range selection & show hints for analysis process #174049

Merged
merged 31 commits into from
Jan 10, 2024

Conversation

qn895
Copy link
Member

@qn895 qn895 commented Dec 29, 2023

Summary

Enhances the selection behavior in the Data Drift view to allow time ranges which overlap in the Reference and Comparison data sets to be analyzed. Improvements include:

  • Allow for the Reference and Comparison time range to be able to overlap
  • Click on each chart to set the time range
  • Prompts and hints for user
Screenshot 2024-01-26 at 10 43 31
Screen.Recording.2024-01-04.at.16.32.34.mov

Checklist

@qn895 qn895 self-assigned this Dec 29, 2023
@qn895 qn895 added :ml release_note:feature Makes this part of the condensed release notes v8.13.0 labels Dec 29, 2023
@qn895 qn895 requested a review from walterra January 2, 2024 16:30
@qn895 qn895 marked this pull request as ready for review January 2, 2024 23:23
@qn895 qn895 requested review from a team as code owners January 2, 2024 23:23
]
);

const onElementClick: ElementClickListener = useCallback(
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm finding that the range selected on click doesn't coincide with the clicked on histogram bucket. Is this the expected behavior? Currently I always have to adjust the range that is created on click.

data_drift_selection

Copy link
Member Author

@qn895 qn895 Jan 4, 2024

Choose a reason for hiding this comment

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

Updated here 42cedad

Screen.Recording.2024-01-04.at.16.32.34.mov

</div>
</div>
) : (
<EuiText color="subdued" size="s" textAlign="center">
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we only allow the analysis to be run when a selection is made in both charts? Currently it looks like a default range is set in the Comparison chart on selection in the Reference chart but the brush only appears when you perform a click in the Reference chart. The other option would be to add brushes to both charts when the first click is made in either chart.

image

Copy link
Member Author

@qn895 qn895 Jan 4, 2024

Choose a reason for hiding this comment

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

Updated here 42cedad

Screen.Recording.2024-01-04.at.16.32.34.mov

}
if (showRunAnalysisHint) {
return (
<EuiEmptyPrompt
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: You could break that inline component out into its own component.

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 7963cae

locale={i18n.getLocale()}
/>
<Axis
id="data-drift-histogram-left-axis"
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we have to create more dynamic ids here since the chart will show up multiple times in the UI? Or is this just something internal to the code since it's canvas based and the id might not end up in the DOM?

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 7963cae


/**
* SingleBrush React Component
* Dual brush component that overlays the document count chart
Copy link
Contributor

Choose a reason for hiding this comment

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

Dual brush component -> Single brush component

Copy link
Member Author

@qn895 qn895 Jan 4, 2024

Choose a reason for hiding this comment

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

Updated here 7963cae


return {
min: Math.round(baselineMin),
max: Math.round(baselineMax),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest to use the deviation time range here. The baseline is a time range before the deviation and has quite an offset to where the user clicked. See the following example, I'm clicking on the spike in the dataset but the selected time range will be way behind it:

ml-data-drift-0001

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

Overall I agree it's the right thing to do here to duplicate the charts/brush code from AIOps first to get this feature in. This way there's no risk to introduce regressions in the original code. However, there's some potential for code consolidation. Some of the code related to the brushes is quite complex and diverged versions will be tricky to maintain in the long run. Suggest to do the following:

*
* @param windowParameters Baseline and deviation time ranges.
* @param force Force update
* @param logRateAnalysisType `spike` or `dip` based on median log rate bucket size
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be removed.

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 42cedad

/**
* Callback function which gets called when the brush selection has changed
*
* @param windowParameters Baseline and deviation time ranges.
Copy link
Contributor

Choose a reason for hiding this comment

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

This mentions baseline/deviation which isn't applicable to the singular chart.

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 42cedad


function onWindowParametersChange(
wp: SingleBrushWindowParameters,
wpPx: SingleBrushWindowParameters
Copy link
Contributor

Choose a reason for hiding this comment

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

The wpPx arg can be removed, it's not used.

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 42cedad

{windowParameters && (
<>
<DualBrushAnnotation
id="aiopsBaseline"
Copy link
Contributor

Choose a reason for hiding this comment

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

aiopsBaseline -> data-drift-annotation

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 42cedad

return 'data-drift-' + b.id;
})
.attr('data-test-subj', (b: SingleBrush) => {
// Uppercase the first character of the `id` so we get aiopsBrushBaseline/aiopsBrushDeviation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment still mentions aiops and both brushes.

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 42cedad

@qn895 qn895 removed the request for review from a team January 4, 2024 23:06
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

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

Latest changes LGTM.

@qn895
Copy link
Member Author

qn895 commented Jan 5, 2024

Created a PR for the code consolidation here #174377, along with TODO comments 0fa5e00

@qn895 qn895 enabled auto-merge (squash) January 5, 2024 17:29
@qn895
Copy link
Member Author

qn895 commented Jan 10, 2024

@elasticmachine merge upstream

@qn895 qn895 force-pushed the ml-data-drift-updated-charts branch from d33969b to f88bb8e Compare January 10, 2024 20:01
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
dataVisualizer 576 580 +4

Async chunks

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

id before after diff
dataVisualizer 616.3KB 613.6KB -2.7KB
Unknown metric groups

ESLint disabled line counts

id before after diff
dataVisualizer 47 51 +4

Total ESLint disabled count

id before after diff
dataVisualizer 47 51 +4

History

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

cc @qn895

@qn895 qn895 merged commit deebfaf into elastic:main Jan 10, 2024
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jan 10, 2024
delanni pushed a commit to delanni/kibana that referenced this pull request Jan 11, 2024
…s process (elastic#174049)

## Summary

Enhances the selection behavior in the Data Drift view to allow time
ranges which overlap in the Reference and Comparison data sets to be
analyzed. Improvements include:

- Allow for the Reference and Comparison time range to be able to
overlap
- Click on each chart to set the time range
- Prompts and hints for user



https://github.com/elastic/kibana/assets/43350163/55f01e41-76e0-4a23-a41c-137349a84bf1




### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <[email protected]>
@peteharverson peteharverson added release_note:enhancement and removed release_note:feature Makes this part of the condensed release notes labels Feb 14, 2024
@szabosteve szabosteve changed the title [ML] Improve Data drift time range selection & show hints for analysis process [ML] Improves Data drift time range selection & show hints for analysis process Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting :ml release_note:enhancement v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants