From a6192037744af6dd016737cdf36d111766cb7d2c Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Fri, 20 Dec 2019 11:53:34 +0100 Subject: [PATCH] hide async kql telemetry service --- .../server/kql_telemetry/kql_telemetry_service.ts | 13 +++++++++---- src/plugins/data/server/plugin.ts | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/plugins/data/server/kql_telemetry/kql_telemetry_service.ts b/src/plugins/data/server/kql_telemetry/kql_telemetry_service.ts index 3ba004ab24436..8f68e63703d40 100644 --- a/src/plugins/data/server/kql_telemetry/kql_telemetry_service.ts +++ b/src/plugins/data/server/kql_telemetry/kql_telemetry_service.ts @@ -26,7 +26,7 @@ import { makeKQLUsageCollector } from './usage_collector'; export class KqlTelemetryService implements Plugin { constructor(private initializerContext: PluginInitializerContext) {} - public async setup( + public setup( { http, savedObjects }: CoreSetup, { usageCollection }: { usageCollection?: UsageCollectionSetup } ) { @@ -37,10 +37,15 @@ export class KqlTelemetryService implements Plugin { ); if (usageCollection) { - const config = await this.initializerContext.config.legacy.globalConfig$ + this.initializerContext.config.legacy.globalConfig$ .pipe(first()) - .toPromise(); - makeKQLUsageCollector(usageCollection, config.kibana.index); + .toPromise() + .then(config => makeKQLUsageCollector(usageCollection, config.kibana.index)) + .catch(e => { + this.initializerContext.logger + .get('kql-telemetry') + .warn(`Registering KQL telemetry collector failed: ${e}`); + }); } } diff --git a/src/plugins/data/server/plugin.ts b/src/plugins/data/server/plugin.ts index d00477a18663a..591fdb4c4080d 100644 --- a/src/plugins/data/server/plugin.ts +++ b/src/plugins/data/server/plugin.ts @@ -46,7 +46,7 @@ export class DataServerPlugin implements Plugin { this.kqlTelemetryService = new KqlTelemetryService(initializerContext); } - public async setup(core: CoreSetup, { usageCollection }: DataPluginSetupDependencies) { + public setup(core: CoreSetup, { usageCollection }: DataPluginSetupDependencies) { this.indexPatterns.setup(core); this.scriptsService.setup(core); this.autocompleteService.setup(core);