reuse telemetry constants (#92099)

This commit is contained in:
Benjamin Pasero
2020-03-10 07:58:04 +01:00
committed by GitHub
parent ffcd280b53
commit b419081bbc
3 changed files with 8 additions and 16 deletions

View File

@@ -26,7 +26,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IURLService } from 'vs/platform/url/common/url';
import { URLHandlerChannelClient, URLHandlerRouter } from 'vs/platform/url/common/urlIpc';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { ITelemetryService, machineIdKey, trueMachineIdKey } from 'vs/platform/telemetry/common/telemetry';
import { NullTelemetryService, combinedAppender, LogAppender } from 'vs/platform/telemetry/common/telemetryUtils';
import { TelemetryAppenderClient } from 'vs/platform/telemetry/node/telemetryIpc';
import { TelemetryService, ITelemetryServiceConfig } from 'vs/platform/telemetry/common/telemetryService';
@@ -79,10 +79,6 @@ import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
import { coalesce } from 'vs/base/common/arrays';
export class CodeApplication extends Disposable {
private static readonly MACHINE_ID_KEY = 'telemetry.machineId';
private static readonly TRUE_MACHINE_ID_KEY = 'telemetry.trueMachineId';
private windowsMainService: IWindowsMainService | undefined;
private dialogMainService: IDialogMainService | undefined;
@@ -407,21 +403,21 @@ export class CodeApplication extends Disposable {
// We cache the machineId for faster lookups on startup
// and resolve it only once initially if not cached
let machineId = this.stateService.getItem<string>(CodeApplication.MACHINE_ID_KEY);
let machineId = this.stateService.getItem<string>(machineIdKey);
if (!machineId) {
machineId = await getMachineId();
this.stateService.setItem(CodeApplication.MACHINE_ID_KEY, machineId);
this.stateService.setItem(machineIdKey, machineId);
}
// Check if machineId is hashed iBridge Device
let trueMachineId: string | undefined;
if (isMacintosh && machineId === '6c9d2bc8f91b89624add29c0abeae7fb42bf539fa1cdb2e3e57cd668fa9bcead') {
trueMachineId = this.stateService.getItem<string>(CodeApplication.TRUE_MACHINE_ID_KEY);
trueMachineId = this.stateService.getItem<string>(trueMachineIdKey);
if (!trueMachineId) {
trueMachineId = await getMachineId();
this.stateService.setItem(CodeApplication.TRUE_MACHINE_ID_KEY, trueMachineId);
this.stateService.setItem(trueMachineIdKey, trueMachineId);
}
}