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] Embeddable Anomaly Swimlane #64056

Merged
merged 58 commits into from
May 4, 2020

Conversation

darnautov
Copy link
Contributor

@darnautov darnautov commented Apr 21, 2020

Summary

Apr-23-2020 15-42-23

Adds support of ML Anomaly Swimlane embedding on the Dashboard.

At the moment Swimlane Embeddabale supports the following:

  • Select multiple jobs
  • "Overall" or "View By" types of swimlanes
  • Custom time range per swimlane embeddable instance
  • Update swimlane data based on the panel size
  • Filters and query support (requires any visualization of the original index to be added to the dashboard)
  • Edit of the swimlane embeddable input with "Edit swimlane" action

Some highlights of the implementation:

  • ExplorerService is responsible for fetching data for swimlanes. Logic has been moved out of explorer utils that depends on the dependency cache. We should avoid such dependencies and use DI to instantiate services.
  • Chart tooltip service and component were rewritten because they cased page freezing
  • HttpService. I'm going to replace the currently used http and http$ functions in a follow-up.
  • MlAnomalyDetectorService for fetching selected jobs by id and extracting influencers' values. I know we currently have a job service, but it relies on fetching all the data upfront and cache it which is not optimal and adds a lot of overhead to the usage in a lightweight widget on the dashboard. Ideally, we should move the logic from the legacy jobs service and optimize the data fetching.
  • JobSelectorFlyout has been extracted from the job_selector.tsx to be used for providing embeddable's input.
  • Refactor several components to TS

Checklist

@darnautov darnautov force-pushed the ML-swimlane-embeddable branch 2 times, most recently from 016b79c to 9f5715c Compare April 23, 2020 08:35
@darnautov darnautov self-assigned this Apr 23, 2020
@darnautov darnautov added :ml Feature:Anomaly Detection ML anomaly detection Feature:Embedding Embedding content via iFrame labels Apr 23, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@darnautov darnautov force-pushed the ML-swimlane-embeddable branch from 9f5715c to 8b8f713 Compare April 23, 2020 10:31
@elastic elastic deleted a comment from kibanamachine Apr 23, 2020
@darnautov darnautov added the v7.8 label Apr 23, 2020
@stacey-gammon
Copy link
Contributor

@darnautov - I'm pretty sure trying to do what @AlonaNadler is asking is not going to be doable by FF (but by all means, you can try if you disagree). We talked in a meeting earlier, I think it must have been right after her comment above. No problem merging as it is, under the "create new" button, and we are going to rethink the entire add panel for 7.9.

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

@darnautov
Copy link
Contributor Author

@elasticmachine merge upstream

@darnautov
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

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

LGTM

@darnautov
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@streamich streamich left a comment

Choose a reason for hiding this comment

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

I've mostly looked at embeddable specific changes, which LGTM. I like how in AnomalySwimlaneEmbeddable you only use that embeddable to render a React component and give it reload$ observable, without any other fluff. 👍

BTW, we are planning to improve that, it should be way simpler to use a React component as your embeddable in the future.

}

public render(node: HTMLElement) {
this.node = node;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, please add

super.render(node)

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 edit functionality and LGTM

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@darnautov darnautov merged commit f62df99 into elastic:master May 4, 2020
@darnautov darnautov deleted the ML-swimlane-embeddable branch May 4, 2020 17:10
darnautov added a commit to darnautov/kibana that referenced this pull request May 4, 2020
* [ML] embeddables setup

* [ML] fix initialization

* [ML] ts refactoring

* [ML] refactor time_buckets.js

* [ML] async services

* [ML] extract job_selector_flyout.tsx

* [ML] fetch overall swimlane data

* [ML] import explorer styles

* [ML] revert package_globs.ts

* [ML] refactor with container, services with DI

* [ML] resize throttle, fetch based on chart width

* [ML] swimlane embeddable setup

* [ML] explorer service

* [ML] chart_tooltip_service

* [ML] fix types

* [ML] overall type for single job with no influencers

* [ML] improve anomaly_swimlane_initializer ux

* [ML] fix services initialization, unsubscribe on destroy

* [ML] support custom time range

* [ML] add tooltip

* [ML] rollback initGetSwimlaneBucketInterval

* [ML] new tooltip service

* [ML] MlTooltipComponent with render props, fix warning

* [ML] fix typo in the filename

* [ML] remove redundant time range output

* [ML] fix time_buckets.test.js jest tests

* [ML] fix explorer chart tests

* [ML] swimlane tests

* [ML] store job ids instead of complete job objects

* [ML] swimlane limit input

* [ML] memo tooltip component, loading indicator

* [ML] scrollable content

* [ML] support query and filters

* [ML] handle query syntax errors

* [ML] rename anomaly_swimlane_service

* [ML] introduce constants

* [ML] edit panel title during setup

* [ML] withTimeRangeSelector

* [ML] rename explorer_service

* [ML] getJobs$ method with one API call

* [ML] fix groups selection

* [ML] swimlane input resolver hook

* [ML] useSwimlaneInputResolver tests

* [ML] factory test

* [ML] container test

* [ML] set wrapper

* [ML] tooltip tests

* [ML] fix displayScore

* [ML] label colors

* [ML] support edit mode

* [ML] call super render

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
spalger added a commit that referenced this pull request May 4, 2020
@spalger
Copy link
Contributor

spalger commented May 4, 2020

Had to revert this PR because it caused typecheck errors once merged into master. https://kibana-ci.elastic.co/job/elastic+kibana+master/4912/execution/node/142/log/

Please resubmit with fixes and backport the fix instead 😄

darnautov added a commit to darnautov/kibana that referenced this pull request May 4, 2020
* [ML] embeddables setup

* [ML] fix initialization

* [ML] ts refactoring

* [ML] refactor time_buckets.js

* [ML] async services

* [ML] extract job_selector_flyout.tsx

* [ML] fetch overall swimlane data

* [ML] import explorer styles

* [ML] revert package_globs.ts

* [ML] refactor with container, services with DI

* [ML] resize throttle, fetch based on chart width

* [ML] swimlane embeddable setup

* [ML] explorer service

* [ML] chart_tooltip_service

* [ML] fix types

* [ML] overall type for single job with no influencers

* [ML] improve anomaly_swimlane_initializer ux

* [ML] fix services initialization, unsubscribe on destroy

* [ML] support custom time range

* [ML] add tooltip

* [ML] rollback initGetSwimlaneBucketInterval

* [ML] new tooltip service

* [ML] MlTooltipComponent with render props, fix warning

* [ML] fix typo in the filename

* [ML] remove redundant time range output

* [ML] fix time_buckets.test.js jest tests

* [ML] fix explorer chart tests

* [ML] swimlane tests

* [ML] store job ids instead of complete job objects

* [ML] swimlane limit input

* [ML] memo tooltip component, loading indicator

* [ML] scrollable content

* [ML] support query and filters

* [ML] handle query syntax errors

* [ML] rename anomaly_swimlane_service

* [ML] introduce constants

* [ML] edit panel title during setup

* [ML] withTimeRangeSelector

* [ML] rename explorer_service

* [ML] getJobs$ method with one API call

* [ML] fix groups selection

* [ML] swimlane input resolver hook

* [ML] useSwimlaneInputResolver tests

* [ML] factory test

* [ML] container test

* [ML] set wrapper

* [ML] tooltip tests

* [ML] fix displayScore

* [ML] label colors

* [ML] support edit mode

* [ML] call super render

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit f62df99)
darnautov added a commit that referenced this pull request May 4, 2020
* [ML] Embeddable Anomaly Swimlane (#64056)

* [ML] embeddables setup

* [ML] fix initialization

* [ML] ts refactoring

* [ML] refactor time_buckets.js

* [ML] async services

* [ML] extract job_selector_flyout.tsx

* [ML] fetch overall swimlane data

* [ML] import explorer styles

* [ML] revert package_globs.ts

* [ML] refactor with container, services with DI

* [ML] resize throttle, fetch based on chart width

* [ML] swimlane embeddable setup

* [ML] explorer service

* [ML] chart_tooltip_service

* [ML] fix types

* [ML] overall type for single job with no influencers

* [ML] improve anomaly_swimlane_initializer ux

* [ML] fix services initialization, unsubscribe on destroy

* [ML] support custom time range

* [ML] add tooltip

* [ML] rollback initGetSwimlaneBucketInterval

* [ML] new tooltip service

* [ML] MlTooltipComponent with render props, fix warning

* [ML] fix typo in the filename

* [ML] remove redundant time range output

* [ML] fix time_buckets.test.js jest tests

* [ML] fix explorer chart tests

* [ML] swimlane tests

* [ML] store job ids instead of complete job objects

* [ML] swimlane limit input

* [ML] memo tooltip component, loading indicator

* [ML] scrollable content

* [ML] support query and filters

* [ML] handle query syntax errors

* [ML] rename anomaly_swimlane_service

* [ML] introduce constants

* [ML] edit panel title during setup

* [ML] withTimeRangeSelector

* [ML] rename explorer_service

* [ML] getJobs$ method with one API call

* [ML] fix groups selection

* [ML] swimlane input resolver hook

* [ML] useSwimlaneInputResolver tests

* [ML] factory test

* [ML] container test

* [ML] set wrapper

* [ML] tooltip tests

* [ML] fix displayScore

* [ML] label colors

* [ML] support edit mode

* [ML] call super render

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit f62df99)

* [ML] fix typing issues
darnautov added a commit to darnautov/kibana that referenced this pull request May 4, 2020
* [ML] Embeddable Anomaly Swimlane (elastic#64056)

* [ML] embeddables setup

* [ML] fix initialization

* [ML] ts refactoring

* [ML] refactor time_buckets.js

* [ML] async services

* [ML] extract job_selector_flyout.tsx

* [ML] fetch overall swimlane data

* [ML] import explorer styles

* [ML] revert package_globs.ts

* [ML] refactor with container, services with DI

* [ML] resize throttle, fetch based on chart width

* [ML] swimlane embeddable setup

* [ML] explorer service

* [ML] chart_tooltip_service

* [ML] fix types

* [ML] overall type for single job with no influencers

* [ML] improve anomaly_swimlane_initializer ux

* [ML] fix services initialization, unsubscribe on destroy

* [ML] support custom time range

* [ML] add tooltip

* [ML] rollback initGetSwimlaneBucketInterval

* [ML] new tooltip service

* [ML] MlTooltipComponent with render props, fix warning

* [ML] fix typo in the filename

* [ML] remove redundant time range output

* [ML] fix time_buckets.test.js jest tests

* [ML] fix explorer chart tests

* [ML] swimlane tests

* [ML] store job ids instead of complete job objects

* [ML] swimlane limit input

* [ML] memo tooltip component, loading indicator

* [ML] scrollable content

* [ML] support query and filters

* [ML] handle query syntax errors

* [ML] rename anomaly_swimlane_service

* [ML] introduce constants

* [ML] edit panel title during setup

* [ML] withTimeRangeSelector

* [ML] rename explorer_service

* [ML] getJobs$ method with one API call

* [ML] fix groups selection

* [ML] swimlane input resolver hook

* [ML] useSwimlaneInputResolver tests

* [ML] factory test

* [ML] container test

* [ML] set wrapper

* [ML] tooltip tests

* [ML] fix displayScore

* [ML] label colors

* [ML] support edit mode

* [ML] call super render

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit f62df99)

* [ML] fix typing issues
darnautov added a commit that referenced this pull request May 5, 2020
* [ML] Embeddable Anomaly Swimlane (#64056)

* [ML] embeddables setup

* [ML] fix initialization

* [ML] ts refactoring

* [ML] refactor time_buckets.js

* [ML] async services

* [ML] extract job_selector_flyout.tsx

* [ML] fetch overall swimlane data

* [ML] import explorer styles

* [ML] revert package_globs.ts

* [ML] refactor with container, services with DI

* [ML] resize throttle, fetch based on chart width

* [ML] swimlane embeddable setup

* [ML] explorer service

* [ML] chart_tooltip_service

* [ML] fix types

* [ML] overall type for single job with no influencers

* [ML] improve anomaly_swimlane_initializer ux

* [ML] fix services initialization, unsubscribe on destroy

* [ML] support custom time range

* [ML] add tooltip

* [ML] rollback initGetSwimlaneBucketInterval

* [ML] new tooltip service

* [ML] MlTooltipComponent with render props, fix warning

* [ML] fix typo in the filename

* [ML] remove redundant time range output

* [ML] fix time_buckets.test.js jest tests

* [ML] fix explorer chart tests

* [ML] swimlane tests

* [ML] store job ids instead of complete job objects

* [ML] swimlane limit input

* [ML] memo tooltip component, loading indicator

* [ML] scrollable content

* [ML] support query and filters

* [ML] handle query syntax errors

* [ML] rename anomaly_swimlane_service

* [ML] introduce constants

* [ML] edit panel title during setup

* [ML] withTimeRangeSelector

* [ML] rename explorer_service

* [ML] getJobs$ method with one API call

* [ML] fix groups selection

* [ML] swimlane input resolver hook

* [ML] useSwimlaneInputResolver tests

* [ML] factory test

* [ML] container test

* [ML] set wrapper

* [ML] tooltip tests

* [ML] fix displayScore

* [ML] label colors

* [ML] support edit mode

* [ML] call super render

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit f62df99)

* [ML] fix typing issues

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@darnautov darnautov mentioned this pull request May 14, 2020
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.