mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-13 22:12:07 +01:00
add sqm id for windows (#195377)
* add sqm id for windows * Update src/vs/platform/windows/electron-main/windowsMainService.ts * Update src/vs/platform/sharedProcess/node/sharedProcess.ts * react on review comments * The reg entry is called MachineId not MachineGuid * fix compile error * no need for \\ prefix in reg path * Wait for 1s max (as to not block the startup) to read the SQM value --------- Co-authored-by: Benjamin Pasero <benjamin.pasero@microsoft.com>
This commit is contained in:
co-authored by
Benjamin Pasero
parent
8de0cf79d2
commit
9d32835bd7
@@ -105,7 +105,7 @@ import { ExtensionsScannerService } from 'vs/platform/extensionManagement/node/e
|
||||
import { UserDataProfilesHandler } from 'vs/platform/userDataProfile/electron-main/userDataProfilesHandler';
|
||||
import { ProfileStorageChangesListenerChannel } from 'vs/platform/userDataProfile/electron-main/userDataProfileStorageIpc';
|
||||
import { Promises, RunOnceScheduler, runWhenIdle } from 'vs/base/common/async';
|
||||
import { resolveMachineId } from 'vs/platform/telemetry/electron-main/telemetryUtils';
|
||||
import { resolveMachineId, resolveSqmId } from 'vs/platform/telemetry/electron-main/telemetryUtils';
|
||||
import { ExtensionsProfileScannerService } from 'vs/platform/extensionManagement/node/extensionsProfileScannerService';
|
||||
import { LoggerChannel } from 'vs/platform/log/electron-main/logIpc';
|
||||
import { ILoggerMainService } from 'vs/platform/log/electron-main/loggerService';
|
||||
@@ -596,14 +596,17 @@ export class CodeApplication extends Disposable {
|
||||
|
||||
// Resolve unique machine ID
|
||||
this.logService.trace('Resolving machine identifier...');
|
||||
const machineId = await resolveMachineId(this.stateService, this.logService);
|
||||
const [machineId, sqmId] = await Promise.all([
|
||||
resolveMachineId(this.stateService, this.logService),
|
||||
resolveSqmId(this.stateService, this.logService)
|
||||
]);
|
||||
this.logService.trace(`Resolved machine identifier: ${machineId}`);
|
||||
|
||||
// Shared process
|
||||
const { sharedProcessReady, sharedProcessClient } = this.setupSharedProcess(machineId);
|
||||
const { sharedProcessReady, sharedProcessClient } = this.setupSharedProcess(machineId, sqmId);
|
||||
|
||||
// Services
|
||||
const appInstantiationService = await this.initServices(machineId, sharedProcessReady);
|
||||
const appInstantiationService = await this.initServices(machineId, sqmId, sharedProcessReady);
|
||||
|
||||
// Auth Handler
|
||||
this._register(appInstantiationService.createInstance(ProxyAuthHandler));
|
||||
@@ -956,8 +959,8 @@ export class CodeApplication extends Disposable {
|
||||
return false;
|
||||
}
|
||||
|
||||
private setupSharedProcess(machineId: string): { sharedProcessReady: Promise<MessagePortClient>; sharedProcessClient: Promise<MessagePortClient> } {
|
||||
const sharedProcess = this._register(this.mainInstantiationService.createInstance(SharedProcess, machineId));
|
||||
private setupSharedProcess(machineId: string, sqmId: string): { sharedProcessReady: Promise<MessagePortClient>; sharedProcessClient: Promise<MessagePortClient> } {
|
||||
const sharedProcess = this._register(this.mainInstantiationService.createInstance(SharedProcess, machineId, sqmId));
|
||||
|
||||
const sharedProcessClient = (async () => {
|
||||
this.logService.trace('Main->SharedProcess#connect');
|
||||
@@ -978,7 +981,7 @@ export class CodeApplication extends Disposable {
|
||||
return { sharedProcessReady, sharedProcessClient };
|
||||
}
|
||||
|
||||
private async initServices(machineId: string, sharedProcessReady: Promise<MessagePortClient>): Promise<IInstantiationService> {
|
||||
private async initServices(machineId: string, sqmId: string, sharedProcessReady: Promise<MessagePortClient>): Promise<IInstantiationService> {
|
||||
const services = new ServiceCollection();
|
||||
|
||||
// Update
|
||||
@@ -1001,7 +1004,7 @@ export class CodeApplication extends Disposable {
|
||||
}
|
||||
|
||||
// Windows
|
||||
services.set(IWindowsMainService, new SyncDescriptor(WindowsMainService, [machineId, this.userEnv], false));
|
||||
services.set(IWindowsMainService, new SyncDescriptor(WindowsMainService, [machineId, sqmId, this.userEnv], false));
|
||||
services.set(IAuxiliaryWindowsMainService, new SyncDescriptor(AuxiliaryWindowsMainService, undefined, false));
|
||||
|
||||
// Dialogs
|
||||
@@ -1081,7 +1084,7 @@ export class CodeApplication extends Disposable {
|
||||
const isInternal = isInternalTelemetry(this.productService, this.configurationService);
|
||||
const channel = getDelayedChannel(sharedProcessReady.then(client => client.getChannel('telemetryAppender')));
|
||||
const appender = new TelemetryAppenderClient(channel);
|
||||
const commonProperties = resolveCommonProperties(release(), hostname(), process.arch, this.productService.commit, this.productService.version, machineId, isInternal);
|
||||
const commonProperties = resolveCommonProperties(release(), hostname(), process.arch, this.productService.commit, this.productService.version, machineId, sqmId, isInternal);
|
||||
const piiPaths = getPiiPathsFromEnvironment(this.environmentMainService);
|
||||
const config: ITelemetryServiceConfig = { appenders: [appender], commonProperties, piiPaths, sendErrorTelemetry: true };
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'
|
||||
import { UriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentityService';
|
||||
import { IUserDataProfile, IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile';
|
||||
import { UserDataProfilesReadonlyService } from 'vs/platform/userDataProfile/node/userDataProfile';
|
||||
import { resolveMachineId } from 'vs/platform/telemetry/node/telemetryUtils';
|
||||
import { resolveMachineId, resolveSqmId } from 'vs/platform/telemetry/node/telemetryUtils';
|
||||
import { ExtensionsProfileScannerService } from 'vs/platform/extensionManagement/node/extensionsProfileScannerService';
|
||||
import { LogService } from 'vs/platform/log/common/logService';
|
||||
import { LoggerService } from 'vs/platform/log/node/loggerService';
|
||||
@@ -184,6 +184,7 @@ class CliMain extends Disposable {
|
||||
logService.error(error);
|
||||
}
|
||||
}
|
||||
const sqmId = await resolveSqmId(stateService, logService);
|
||||
|
||||
// Initialize user data profiles after initializing the state
|
||||
userDataProfilesService.init();
|
||||
@@ -219,7 +220,7 @@ class CliMain extends Disposable {
|
||||
const config: ITelemetryServiceConfig = {
|
||||
appenders,
|
||||
sendErrorTelemetry: false,
|
||||
commonProperties: resolveCommonProperties(release(), hostname(), process.arch, productService.commit, productService.version, machineId, isInternal),
|
||||
commonProperties: resolveCommonProperties(release(), hostname(), process.arch, productService.commit, productService.version, machineId, sqmId, isInternal),
|
||||
piiPaths: getPiiPathsFromEnvironment(environmentService)
|
||||
};
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ class SharedProcessMain extends Disposable implements IClientConnectionFilter {
|
||||
|
||||
telemetryService = new TelemetryService({
|
||||
appenders,
|
||||
commonProperties: resolveCommonProperties(release(), hostname(), process.arch, productService.commit, productService.version, this.configuration.machineId, internalTelemetry),
|
||||
commonProperties: resolveCommonProperties(release(), hostname(), process.arch, productService.commit, productService.version, this.configuration.machineId, this.configuration.sqmId, internalTelemetry),
|
||||
sendErrorTelemetry: true,
|
||||
piiPaths: getPiiPathsFromEnvironment(environmentService),
|
||||
}, configurationService, productService);
|
||||
|
||||
Reference in New Issue
Block a user