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

Add lazy loading to Uptime AlertTypes #66188

Closed
gmmorris opened this issue May 12, 2020 · 3 comments · Fixed by #66829
Closed

Add lazy loading to Uptime AlertTypes #66188

gmmorris opened this issue May 12, 2020 · 3 comments · Fixed by #66829
Labels
Feature:Alerting Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability

Comments

@gmmorris
Copy link
Contributor

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 Uptime looks like we have two AlertTypes that need to change:

alertParamsExpression: params => <AlertMonitorStatus {...params} autocomplete={autocomplete} />,

alertParamsExpression: () => <AlertTls />,

Luckily, changing your AlertType to load lazily is relatively straight forward and you can look at the built-in IndexThreshold AlertType as an example:

  1. Export your Expression component as a default export - as this is a hard requirement for lazy loading.

  2. Pass an React.LazyExoticComponent to the AlertType instead of the regular React.FC

That's about it.
Thanks 😊

@gmmorris gmmorris added Feature:Alerting Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability labels May 12, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

@justinkambic
Copy link
Contributor

@gmmorris are we targeting 7.8.0 with this change?

@gmmorris
Copy link
Contributor Author

@gmmorris are we targeting 7.8.0 with this change?

Nope, 7.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Alerting Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants