Skip to content

Commit

Permalink
hide async kql telemetry service
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Dec 20, 2019
1 parent 69522fd commit a619203
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/plugins/data/server/kql_telemetry/kql_telemetry_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { makeKQLUsageCollector } from './usage_collector';
export class KqlTelemetryService implements Plugin<void> {
constructor(private initializerContext: PluginInitializerContext) {}

public async setup(
public setup(
{ http, savedObjects }: CoreSetup,
{ usageCollection }: { usageCollection?: UsageCollectionSetup }
) {
Expand All @@ -37,10 +37,15 @@ export class KqlTelemetryService implements Plugin<void> {
);

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}`);
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class DataServerPlugin implements Plugin<DataPluginSetup> {
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);
Expand Down

0 comments on commit a619203

Please sign in to comment.