From 77d9d9b4abaafa90fa688e89bd5b7cbe3610d8bd Mon Sep 17 00:00:00 2001 From: restrry Date: Mon, 25 May 2020 15:43:30 +0200 Subject: [PATCH] use es client provided from start contract --- src/plugins/telemetry/server/plugin.ts | 2 +- .../telemetry_collection_xpack/server/plugin.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/telemetry/server/plugin.ts b/src/plugins/telemetry/server/plugin.ts index 8ae63682413e5..80674ba040385 100644 --- a/src/plugins/telemetry/server/plugin.ts +++ b/src/plugins/telemetry/server/plugin.ts @@ -82,7 +82,6 @@ export class TelemetryPlugin implements Plugin { const config$ = this.config$; const isDev = this.isDev; - registerCollection(telemetryCollectionManager, elasticsearch.dataClient); const router = http.createRouter(); registerRoutes({ @@ -109,6 +108,7 @@ export class TelemetryPlugin implements Plugin { this.logger.warn('Unable to update legacy telemetry configs.'); } + registerCollection(telemetryCollectionManager, core.elasticsearch.legacy.client); this.fetcherTask.start(core, { telemetryCollectionManager }); } diff --git a/x-pack/plugins/telemetry_collection_xpack/server/plugin.ts b/x-pack/plugins/telemetry_collection_xpack/server/plugin.ts index b0afba8852495..ac045753a4343 100644 --- a/x-pack/plugins/telemetry_collection_xpack/server/plugin.ts +++ b/x-pack/plugins/telemetry_collection_xpack/server/plugin.ts @@ -5,20 +5,22 @@ */ import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from 'kibana/server'; -import { TelemetryCollectionManagerPluginSetup } from 'src/plugins/telemetry_collection_manager/server'; +import { TelemetryCollectionManagerPluginStart } from 'src/plugins/telemetry_collection_manager/server'; import { getClusterUuids, getLocalLicense } from '../../../../src/plugins/telemetry/server'; import { getStatsWithXpack } from './telemetry_collection'; interface TelemetryCollectionXpackDepsSetup { - telemetryCollectionManager: TelemetryCollectionManagerPluginSetup; + telemetryCollectionManager: TelemetryCollectionManagerPluginStart; } export class TelemetryCollectionXpackPlugin implements Plugin { constructor(initializerContext: PluginInitializerContext) {} - public setup(core: CoreSetup, { telemetryCollectionManager }: TelemetryCollectionXpackDepsSetup) { + public setup(core: CoreSetup) {} + + public start(core: CoreStart, { telemetryCollectionManager }: TelemetryCollectionXpackDepsSetup) { telemetryCollectionManager.setCollection({ - esCluster: core.elasticsearch.dataClient, + esCluster: core.elasticsearch.legacy.client, title: 'local_xpack', priority: 1, statsGetter: getStatsWithXpack, @@ -26,6 +28,4 @@ export class TelemetryCollectionXpackPlugin implements Plugin { licenseGetter: getLocalLicense, }); } - - public start(core: CoreStart) {} }