centralize telemetry level (#131919)

* centralize telemetry level

* add comments and const enum
This commit is contained in:
SteVen Batten
2021-08-30 10:38:42 -07:00
committed by GitHub
parent 9c6b9f0bf5
commit 9525d0e1ed
7 changed files with 46 additions and 13 deletions

View File

@@ -68,7 +68,7 @@ import { resolveCommonProperties } from 'vs/platform/telemetry/common/commonProp
import { ITelemetryService, machineIdKey } from 'vs/platform/telemetry/common/telemetry';
import { TelemetryAppenderClient } from 'vs/platform/telemetry/common/telemetryIpc';
import { ITelemetryServiceConfig, TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
import { NullTelemetryService, getTelemetryLevel, TelemetryLevel } from 'vs/platform/telemetry/common/telemetryUtils';
import { IUpdateService } from 'vs/platform/update/common/update';
import { UpdateChannel } from 'vs/platform/update/common/updateIpc';
import { DarwinUpdateService } from 'vs/platform/update/electron-main/updateService.darwin';
@@ -531,7 +531,7 @@ export class CodeApplication extends Disposable {
services.set(IURLService, new SyncDescriptor(NativeURLService));
// Telemetry
if (!this.environmentMainService.isExtensionDevelopment && !this.environmentMainService.args['disable-telemetry'] && !!this.productService.enableTelemetry) {
if (getTelemetryLevel(this.productService, this.environmentMainService) === TelemetryLevel.USER) {
const channel = getDelayedChannel(sharedProcessReady.then(client => client.getChannel('telemetryAppender')));
const appender = new TelemetryAppenderClient(channel);
const commonProperties = resolveCommonProperties(this.fileService, release(), hostname(), process.arch, this.productService.commit, this.productService.version, machineId, this.productService.msftInternalDomains, this.environmentMainService.installSourcePath);