Skip to content

Commit

Permalink
Made imports static (#89935)
Browse files Browse the repository at this point in the history
  • Loading branch information
igoristic authored Feb 2, 2021
1 parent d601090 commit 802ac60
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions x-pack/plugins/monitoring/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ import {
ALERT_DETAILS,
} from '../common/constants';

import { createCpuUsageAlertType } from './alerts/cpu_usage_alert';
import { createMissingMonitoringDataAlertType } from './alerts/missing_monitoring_data_alert';
import { createLegacyAlertTypes } from './alerts/legacy_alert';
import { createDiskUsageAlertType } from './alerts/disk_usage_alert';
import { createThreadPoolRejectionsAlertType } from './alerts/thread_pool_rejections_alert';
import { createMemoryUsageAlertType } from './alerts/memory_usage_alert';
import { createCCRReadExceptionsAlertType } from './alerts/ccr_read_exceptions_alert';

interface MonitoringSetupPluginDependencies {
home?: HomePublicPluginSetup;
cloud?: { isCloudEnabled: boolean };
Expand Down Expand Up @@ -72,7 +80,7 @@ export class MonitoringPlugin
});
}

await this.registerAlertsAsync(plugins);
this.registerAlerts(plugins);

const app: App = {
id,
Expand Down Expand Up @@ -135,19 +143,7 @@ export class MonitoringPlugin
];
}

private registerAlertsAsync = async (plugins: MonitoringSetupPluginDependencies) => {
const { createCpuUsageAlertType } = await import('./alerts/cpu_usage_alert');
const { createMissingMonitoringDataAlertType } = await import(
'./alerts/missing_monitoring_data_alert'
);
const { createLegacyAlertTypes } = await import('./alerts/legacy_alert');
const { createDiskUsageAlertType } = await import('./alerts/disk_usage_alert');
const { createThreadPoolRejectionsAlertType } = await import(
'./alerts/thread_pool_rejections_alert'
);
const { createMemoryUsageAlertType } = await import('./alerts/memory_usage_alert');
const { createCCRReadExceptionsAlertType } = await import('./alerts/ccr_read_exceptions_alert');

private registerAlerts(plugins: MonitoringSetupPluginDependencies) {
const {
triggersActionsUi: { alertTypeRegistry },
} = plugins;
Expand All @@ -172,5 +168,5 @@ export class MonitoringPlugin
for (const legacyAlertType of legacyAlertTypes) {
alertTypeRegistry.register(legacyAlertType);
}
};
}
}

0 comments on commit 802ac60

Please sign in to comment.