-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Add lazy loading to APM AlertTypes #66189
Labels
Comments
gmmorris
added
Team:APM
All issues that need APM UI Team support
Feature:Alerting
labels
May 12, 2020
Pinging @elastic/apm-ui (Team:apm) |
smith
added a commit
to smith/kibana
that referenced
this issue
Jun 10, 2020
Use `React.lazy` to load the alert triggers so the code doesn't load until the alert flyout is opened. Fixes elastic#66189.
smith
added a commit
that referenced
this issue
Jun 10, 2020
Use `React.lazy` to load the alert triggers so the code doesn't load until the alert flyout is opened. Fixes #66189.
smith
added a commit
to smith/kibana
that referenced
this issue
Jun 10, 2020
Use `React.lazy` to load the alert triggers so the code doesn't load until the alert flyout is opened. Fixes elastic#66189.
smith
added a commit
that referenced
this issue
Jun 11, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey team,
In the Alerting team we've been addressing an issue where Kibana is forced to pre-load a bunch of React components at startup that aren't actually needed until the Alerting UI or flyout are opened: #65678 (Once this PR is merged)
Sadly, this requires changes in how the AlertTypes are actually registered by solutions and so we'd ask that, when you have capacity to do so, you make a small change in how you register your alerts.
In the case of APM looks like we have two AlertTypes that need to change:
kibana/x-pack/plugins/apm/public/plugin.ts
Line 115 in 592e234
kibana/x-pack/plugins/apm/public/plugin.ts
Line 127 in 592e234
Luckily, changing your AlertType to load lazily is relatively straight forward and you can look at the built-in IndexThreshold AlertType as an example:
Export your Expression component as a
default
export - as this is a hard requirement for lazy loading.kibana/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_alert_types/threshold/expression.tsx
Line 469 in 0736325
Pass an
React.LazyExoticComponent
to the AlertType instead of the regular React.FCkibana/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_alert_types/threshold/index.ts
Line 18 in 0736325
That's about it.
Thanks 😊
The text was updated successfully, but these errors were encountered: