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] Package @kbn/ml-anomaly-utils #155697

Merged
merged 43 commits into from
May 3, 2023

Conversation

walterra
Copy link
Contributor

@walterra walterra commented Apr 25, 2023

Summary

Part of #156643.

Creates Package @kbn/ml-anomaly-utils.

  • This moves some of the utility functions, constants and types related to Anomaly Detection we previously exposed from the ml plugin itself to a package @kbn/ml-anomaly-utils, resulting in ~5.9KB reduction of the plugin's page load bundle size.
  • To reduce increases in async bundle size for consuming plugins the utils have been refactored into individual files to allow deep imports and get some optimization through that. Some previously duplicated code in consuming plugins has been deleted and replaced with deep imports of the corresponding original code in the package.
  • Types have been prefixed with Ml.
  • Constants have been prefixed with ML_.

Created package via node scripts/generate package @kbn/ml-anomaly-utils --web --dir ./x-pack/packages/ml/anomaly_utils.

Checklist

@walterra walterra self-assigned this Apr 25, 2023
@walterra walterra force-pushed the ml-package-anomaly-utils branch 4 times, most recently from cdeaa2a to ffebdf3 Compare April 25, 2023 12:58
@walterra
Copy link
Contributor Author

walterra commented Apr 25, 2023

Package sizes for 797a10c, consuming plugins are importing the full package:

image

image

Nice, Refactoring and doing deep imports in consuming plugins (1989dcc) works, there's a 1.9KB reduction for apm:

image

Also bringing down async bundle growth for other plugins:

image

@walterra walterra added release_note:skip Skip the PR/issue when compiling release notes v8.9.0 :ml labels Apr 26, 2023
@walterra walterra marked this pull request as ready for review April 27, 2023 04:29
@walterra walterra requested review from a team as code owners April 27, 2023 04:29
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@botelastic botelastic bot added Team:APM All issues that need APM UI Team support Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability labels Apr 27, 2023
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

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.

APM changes lgtm

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

Copy link
Member

@spong spong left a comment

Choose a reason for hiding this comment

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

Security Solution changes LGTM! 👍 Thanks for the cleanup here @walterra

Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

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

LGTM !!

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.

LGTM

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
apm 1331 1337 +6
infra 1389 1392 +3
ml 1724 1732 +8
synthetics 1243 1250 +7
total +24

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
ml 81 80 -1

Any counts in public APIs

Total count of every any typed public API. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats any for more detailed information.

id before after diff
@kbn/ml-anomaly-utils - 3 +3
ml 9 3 -6
total -3

Async chunks

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

id before after diff
apm 3.5MB 3.5MB +1.3KB
infra 2.0MB 2.0MB +4.0B
ml 3.4MB 3.4MB +2.6KB
synthetics 1.2MB 1.2MB +2.2KB
total +6.2KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
ml 41 36 -5

Page load bundle

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

id before after diff
apm 32.3KB 32.4KB +43.0B
ml 77.4KB 71.5KB -5.9KB
synthetics 27.4KB 27.3KB -132.0B
total -6.0KB
Unknown metric groups

API count

id before after diff
@kbn/ml-anomaly-utils - 142 +142
ml 257 166 -91
total +51

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
securitySolution 398 401 +3
total +5

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
securitySolution 478 481 +3
total +5

History

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

cc @walterra

Copy link
Contributor

@tonyghiani tonyghiani left a comment

Choose a reason for hiding this comment

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

Infra changes LGTM!

@walterra walterra merged commit 385d0dc into elastic:main May 3, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label May 3, 2023
@walterra walterra deleted the ml-package-anomaly-utils branch May 3, 2023 06:46
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:skip Skip the PR/issue when compiling release notes Team:APM All issues that need APM UI Team support Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants