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

[8.x] [ML] Anomaly Explorer: Enhancements for Embeddables with Selected Groups & Explorer Refactor (#203224) #204361

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.x:

Questions ?

Please refer to the Backport tool documentation

…ups & Explorer Refactor (elastic#203224)

## Summary

Fixes issues around handling groupIds in Anomaly Explorer:
[elastic#198824](elastic#198824)

* `UrlStateService` is now more generic, allowing for the creation of
`useGlobalUrlState` and `usePageUrlState` hooks based on it.
* New `useGlobalUrlState` hook: Responsible for managing global state
with proper typing.
* `id_badges.js` converted to typescript -> `id_badges.tsx`
* The use of `maps` in the `id_badges`, `job_selector` and
`job_selector_flyout` components has been removed. Now, selected group
and job ids are passed directly.
* Instead of manually setting the global state in `job_selector`, an
`onSelectionChange` callback is now expected. In the future, the
`Timeseries explorer` and `Anomaly Explorer` are expected to use a
(maybe) shared context to track selected jobs easily, eliminating the
need to manually update the global state for the `Timeseries explorer`.
* The `AnomalyExplorerCommonStateService` now listens for URL changes to
track properties derived from the URL. This replaces the `useUrlState`
hook, which lacked proper typing, and serves as the single source of
truth for selected jobs and groups.
* The `ExplorerDashboardService`, previously a hybrid of a "service" and
redux-like action handler, has been removed. The state is now managed
within `state_manager` component. In the future, data like `chartsData`
and `influencers` should be decoupled from `ExplorerState` and moved to
individual services.

1. Fix for all issues mentioned in elastic#198824 as visible in the video:
- The initial group selection now results in the correct badge being
displayed.
- Creating an embeddable with a selected group properly propagates the
selected group instead of individual job ids.
- Navigating to the Anomaly Explorer from Dashboards now correctly uses
the selected group instead of individual job ids.

https://github.com/user-attachments/assets/82c641e0-d930-42eb-8627-fad4bdc417f6

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit ea85f05)
@kibanamachine kibanamachine merged commit f06217c into elastic:8.x Dec 16, 2024
11 checks passed
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
aiops 623 625 +2
dataVisualizer 733 735 +2
ml 2138 2129 -9
total -5

Async chunks

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

id before after diff
aiops 616.3KB 621.7KB +5.4KB
dataVisualizer 614.8KB 614.9KB +19.0B
ml 4.7MB 4.7MB +7.3KB
transform 475.3KB 475.5KB +211.0B
total +13.0KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
dataVisualizer 24.5KB 26.2KB +1.8KB
ml 76.5KB 78.3KB +1.9KB
total +3.6KB
Unknown metric groups

ESLint disabled line counts

id before after diff
@kbn/ml-url-state 7 6 -1
ml 567 558 -9
total -10

Total ESLint disabled count

id before after diff
@kbn/ml-url-state 7 6 -1
ml 570 561 -9
total -10

cc @rbrtj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants