Skip to content

Commit

Permalink
Lazy load alert types
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro Fernández Gómez committed Feb 17, 2021
1 parent 0d5b2c6 commit 72b0e3c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions x-pack/plugins/infra/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
import { i18n } from '@kbn/i18n';
import { AppMountParameters, PluginInitializerContext } from 'kibana/public';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
import { createMetricThresholdAlertType } from './alerting/metric_threshold';
import { createInventoryMetricAlertType } from './alerting/inventory';
import { createMetricAnomalyAlertType } from './alerting/metric_anomaly';
import { getAlertType as getLogsAlertType } from './alerting/log_threshold';
import { registerFeatures } from './register_feature';
import {
InfraClientSetupDeps,
Expand All @@ -33,10 +29,18 @@ export class Plugin implements InfraClientPluginClass {
registerFeatures(pluginsSetup.home);
}

pluginsSetup.triggersActionsUi.alertTypeRegistry.register(createInventoryMetricAlertType());
pluginsSetup.triggersActionsUi.alertTypeRegistry.register(getLogsAlertType());
pluginsSetup.triggersActionsUi.alertTypeRegistry.register(createMetricThresholdAlertType());
pluginsSetup.triggersActionsUi.alertTypeRegistry.register(createMetricAnomalyAlertType());
import('./alerting/log_threshold').then(({ getAlertType: getLogsAlertType }) =>
pluginsSetup.triggersActionsUi.alertTypeRegistry.register(getLogsAlertType())
);
import('./alerting/inventory').then(({ createInventoryMetricAlertType }) =>
pluginsSetup.triggersActionsUi.alertTypeRegistry.register(createInventoryMetricAlertType())
);
import('./alerting/metric_threshold').then(({ createMetricThresholdAlertType }) =>
pluginsSetup.triggersActionsUi.alertTypeRegistry.register(createMetricThresholdAlertType())
);
import('./alerting/metric_anomaly').then(({ createMetricAnomalyAlertType }) =>
pluginsSetup.triggersActionsUi.alertTypeRegistry.register(createMetricAnomalyAlertType())
);

if (pluginsSetup.observability) {
pluginsSetup.observability.dashboard.register({
Expand Down

0 comments on commit 72b0e3c

Please sign in to comment.