@@ -20,8 +20,6 @@ import {
2020 CoreStart ,
2121 CustomHttpResponseOptions ,
2222 ResponseError ,
23- IClusterClient ,
24- SavedObjectsServiceStart ,
2523} from 'kibana/server' ;
2624import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server' ;
2725import {
@@ -41,7 +39,7 @@ import { initInfraSource } from './lib/logs/init_infra_source';
4139import { mbSafeQuery } from './lib/mb_safe_query' ;
4240import { instantiateClient } from './es_client/instantiate_client' ;
4341import { registerCollectors } from './kibana_monitoring/collectors' ;
44- import { registerMonitoringCollection } from './telemetry_collection' ;
42+ import { registerMonitoringTelemetryCollection } from './telemetry_collection' ;
4543import { LicenseService } from './license_service' ;
4644import { AlertsFactory } from './alerts' ;
4745import {
@@ -76,8 +74,6 @@ export class Plugin {
7674 private monitoringCore = { } as MonitoringCore ;
7775 private legacyShimDependencies = { } as LegacyShimDependencies ;
7876 private bulkUploader : IBulkUploader = { } as IBulkUploader ;
79- private telemetryElasticsearchClient : IClusterClient | undefined ;
80- private telemetrySavedObjectsService : SavedObjectsServiceStart | undefined ;
8177
8278 constructor ( initializerContext : PluginInitializerContext ) {
8379 this . initializerContext = initializerContext ;
@@ -145,19 +141,6 @@ export class Plugin {
145141 plugins . alerts ?. registerType ( alert . getAlertType ( ) ) ;
146142 }
147143
148- // Initialize telemetry
149- if ( plugins . telemetryCollectionManager ) {
150- registerMonitoringCollection ( {
151- telemetryCollectionManager : plugins . telemetryCollectionManager ,
152- esCluster : this . cluster ,
153- esClientGetter : ( ) => this . telemetryElasticsearchClient ,
154- soServiceGetter : ( ) => this . telemetrySavedObjectsService ,
155- customContext : {
156- maxBucketSize : config . ui . max_bucket_size ,
157- } ,
158- } ) ;
159- }
160-
161144 // Register collector objects for stats to show up in the APIs
162145 if ( plugins . usageCollection ) {
163146 core . savedObjects . registerType ( {
@@ -174,6 +157,11 @@ export class Plugin {
174157 } ) ;
175158
176159 registerCollectors ( plugins . usageCollection , config , cluster . callAsInternalUser ) ;
160+ registerMonitoringTelemetryCollection (
161+ plugins . usageCollection ,
162+ cluster . callAsInternalUser ,
163+ config . ui . max_bucket_size
164+ ) ;
177165 }
178166
179167 // Always create the bulk uploader
@@ -253,16 +241,7 @@ export class Plugin {
253241 } ;
254242 }
255243
256- start ( { elasticsearch, savedObjects } : CoreStart ) {
257- // TODO: For the telemetry plugin to work, we need to provide the new ES client.
258- // The new client should be inititalized with a similar config to `this.cluster` but, since we're not using
259- // the new client in Monitoring Telemetry collection yet, setting the local client allows progress for now.
260- // The usage collector `fetch` method has been refactored to accept a `collectorFetchContext` object,
261- // exposing both es clients and the saved objects client.
262- // We will update the client in a follow up PR.
263- this . telemetryElasticsearchClient = elasticsearch . client ;
264- this . telemetrySavedObjectsService = savedObjects ;
265- }
244+ start ( ) { }
266245
267246 stop ( ) {
268247 if ( this . cluster ) {
0 commit comments