From d7d511a6cf4ae947f8cf7e9142c183311b29de1c Mon Sep 17 00:00:00 2001 From: Bishoy Boktor Date: Wed, 10 Feb 2021 21:47:03 +0000 Subject: [PATCH] [PURIFY] Removes Telemetry network call and disabled it --- packages/kbn-analytics/src/reporter.ts | 8 ++++---- src/plugins/telemetry/public/services/telemetry_sender.ts | 8 +++++--- .../telemetry/public/services/telemetry_service.ts | 3 +++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/kbn-analytics/src/reporter.ts b/packages/kbn-analytics/src/reporter.ts index 63bccdd24aea..3c1da5d0be31 100644 --- a/packages/kbn-analytics/src/reporter.ts +++ b/packages/kbn-analytics/src/reporter.ts @@ -25,7 +25,7 @@ import { Report, ReportManager } from './report'; import { ApplicationUsage } from './metrics'; export interface ReporterConfig { - http: ReportHTTP; + // http: ReportHTTP; storage?: Storage; checkInterval?: number; debug?: boolean; @@ -38,7 +38,7 @@ export class Reporter { checkInterval: number; private interval?: NodeJS.Timer; private lastAppId?: string; - private http: ReportHTTP; + // private http: ReportHTTP; private reportManager: ReportManager; private storageManager: ReportStorageManager; private readonly applicationUsage: ApplicationUsage; @@ -48,8 +48,8 @@ export class Reporter { private started = false; constructor(config: ReporterConfig) { - const { http, storage, debug, checkInterval = 90000, storageKey = 'analytics' } = config; - this.http = http; + const { storage, debug, checkInterval = 90000, storageKey = 'analytics' } = config; + // this.http = http; this.checkInterval = checkInterval; this.applicationUsage = new ApplicationUsage(); this.storageManager = new ReportStorageManager(storageKey, storage); diff --git a/src/plugins/telemetry/public/services/telemetry_sender.ts b/src/plugins/telemetry/public/services/telemetry_sender.ts index 6770bc9b24e6..5637e9b82e5b 100644 --- a/src/plugins/telemetry/public/services/telemetry_sender.ts +++ b/src/plugins/telemetry/public/services/telemetry_sender.ts @@ -70,9 +70,10 @@ export class TelemetrySender { // mark that we are working so future requests are ignored until we're done this.isSending = true; try { - const telemetryUrl = this.telemetryService.getTelemetryUrl(); - const telemetryData: any | any[] = await this.telemetryService.fetchTelemetry(); - const clusters: string[] = [].concat(telemetryData); + // const telemetryUrl = this.telemetryService.getTelemetryUrl(); + // const telemetryData: any | any[] = await this.telemetryService.fetchTelemetry(); + // const clusters: string[] = [].concat(telemetryData); + /* await Promise.all( clusters.map( async (cluster) => @@ -85,6 +86,7 @@ export class TelemetrySender { }) ) ); + */ this.lastReported = `${Date.now()}`; this.saveToBrowser(); } catch (err) { diff --git a/src/plugins/telemetry/public/services/telemetry_service.ts b/src/plugins/telemetry/public/services/telemetry_service.ts index c6b37f497ecb..c53e2de414cc 100644 --- a/src/plugins/telemetry/public/services/telemetry_service.ts +++ b/src/plugins/telemetry/public/services/telemetry_service.ts @@ -119,6 +119,7 @@ export class TelemetryService { }; public fetchTelemetry = async ({ unencrypted = false } = {}) => { + /* const now = moment(); return this.http.post('/api/telemetry/v2/clusters/_stats', { body: JSON.stringify({ @@ -132,6 +133,8 @@ export class TelemetryService { }, }), }); + */ + return; }; public setOptIn = async (optedIn: boolean): Promise => {