Add lazy loading to Infra AlertTypes #66190
Labels
chore
Feature:Alerting
Feature:Logs UI
Logs UI feature
Feature:Metrics UI
Metrics UI feature
Team:Infra Monitoring UI - DEPRECATED
DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services
Milestone
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 Infra looks like we have three AlertTypes that need to change:
kibana/x-pack/plugins/infra/public/alerting/metric_threshold/index.ts
Line 21 in 592e234
kibana/x-pack/plugins/infra/public/components/alerting/inventory/metric_inventory_threshold_alert_type.ts
Line 21 in 592e234
kibana/x-pack/plugins/infra/public/components/alerting/logs/log_threshold_alert_type.ts
Line 20 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: