From d7ac6e838f51a03f7d417b4758f5fb075878d615 Mon Sep 17 00:00:00 2001 From: Ramya Rao Date: Wed, 31 Oct 2018 20:46:00 -0700 Subject: [PATCH] Avoid creating AppInsightsAppender when --disable-telemetry (#62353) --- .../sharedProcess/sharedProcessMain.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts index 66f7efbf99fc1..030392102cf9a 100644 --- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts @@ -106,13 +106,11 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I telemetryLogService.info('==========================================================='); let appInsightsAppender: ITelemetryAppender | null = NullAppender; - if (product.aiConfig && product.aiConfig.asimovKey && isBuilt) { - appInsightsAppender = new AppInsightsAppender(eventPrefix, null, product.aiConfig.asimovKey, telemetryLogService); - disposables.push(appInsightsAppender); // Ensure the AI appender is disposed so that it flushes remaining data - } - server.registerChannel('telemetryAppender', new TelemetryAppenderChannel(appInsightsAppender)); - if (!extensionDevelopmentLocationURI && !environmentService.args['disable-telemetry'] && product.enableTelemetry) { + if (product.aiConfig && product.aiConfig.asimovKey && isBuilt) { + appInsightsAppender = new AppInsightsAppender(eventPrefix, null, product.aiConfig.asimovKey, telemetryLogService); + disposables.push(appInsightsAppender); // Ensure the AI appender is disposed so that it flushes remaining data + } const config: ITelemetryServiceConfig = { appender: combinedAppender(appInsightsAppender, new LogAppender(logService)), commonProperties: resolveCommonProperties(product.commit, pkg.version, configuration.machineId, installSourcePath), @@ -123,6 +121,7 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I } else { services.set(ITelemetryService, NullTelemetryService); } + server.registerChannel('telemetryAppender', new TelemetryAppenderChannel(appInsightsAppender)); services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService)); services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService));