Skip to content

Commit

Permalink
add explicit contract for monitoring setup
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Feb 1, 2021
1 parent 1dcfcd9 commit b6074c7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions x-pack/plugins/monitoring/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { deprecations } from './deprecations';

export { KibanaSettingsCollector } from './kibana_monitoring/collectors';
export { MonitoringConfig } from './config';
export { MonitoringPluginSetup, IBulkUploader } from './types';

export const plugin = (initContext: PluginInitializerContext) => new MonitoringPlugin(initContext);
export const config: PluginConfigDescriptor<TypeOf<typeof configSchema>> = {
schema: configSchema,
Expand Down
4 changes: 3 additions & 1 deletion x-pack/plugins/monitoring/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { AlertsFactory } from './alerts';
import {
MonitoringCore,
MonitoringLicenseService,
MonitoringPluginSetup,
LegacyShimDependencies,
IBulkUploader,
PluginsSetup,
Expand All @@ -63,7 +64,8 @@ const wrapError = (error: any): CustomHttpResponseOptions<ResponseError> => {
};
};

export class MonitoringPlugin implements Plugin<any, void, PluginsSetup, PluginsStart> {
export class MonitoringPlugin
implements Plugin<MonitoringPluginSetup, void, PluginsSetup, PluginsStart> {
private readonly initializerContext: PluginInitializerContext;
private readonly log: Logger;
private readonly getLogger: (...scopes: string[]) => Logger;
Expand Down
4 changes: 4 additions & 0 deletions x-pack/plugins/monitoring/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ export interface IBulkUploader {
stop: () => void;
}

export interface MonitoringPluginSetup {
getKibanaStats: IBulkUploader['getKibanaStats'];
}

export interface LegacyRequest {
logger: Logger;
getLogger: (...scopes: string[]) => Logger;
Expand Down

0 comments on commit b6074c7

Please sign in to comment.