Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename vsDeviceId #213261

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions build/.moduleignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ fsevents/test/**
@vscode/spdlog/*.yml
!@vscode/spdlog/build/Release/*.node

@vscode/deviceid/binding.gyp
@vscode/deviceid/build/**
@vscode/deviceid/deps/**
@vscode/deviceid/src/**
@vscode/deviceid/test/**
@vscode/deviceid/*.yml
!@vscode/deviceid/build/Release/*.node


@vscode/sqlite3/binding.gyp
@vscode/sqlite3/benchmark/**
@vscode/sqlite3/cloudformation/**
Expand Down
2 changes: 1 addition & 1 deletion src/vs/base/node/id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export async function getSqmMachineId(errorLogger: (error: any) => void): Promis
return '';
}

export async function getVSDeviceId(errorLogger: (error: any) => void): Promise<string> {
export async function getdevDeviceId(errorLogger: (error: any) => void): Promise<string> {
try {
const deviceIdPackage = await import('@vscode/deviceid');
const id = await deviceIdPackage.getDeviceId();
Expand Down
6 changes: 3 additions & 3 deletions src/vs/base/test/node/id.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import * as assert from 'assert';
import { getMachineId, getSqmMachineId, getVSDeviceId } from 'vs/base/node/id';
import { getMachineId, getSqmMachineId, getdevDeviceId } from 'vs/base/node/id';
import { getMac } from 'vs/base/node/macAddress';
import { flakySuite } from 'vs/base/test/node/testUtils';
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';
Expand All @@ -26,9 +26,9 @@ flakySuite('ID', () => {
assert.strictEqual(errors.length, 0);
});

test('getVSDeviceId', async function () {
test('getdevDeviceId', async function () {
const errors = [];
const id = await getVSDeviceId(err => errors.push(err));
const id = await getdevDeviceId(err => errors.push(err));
assert.ok(typeof id === 'string');
assert.strictEqual(errors.length, 0);
});
Expand Down
20 changes: 10 additions & 10 deletions src/vs/code/electron-main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, runWhenGlobalIdle } from 'vs/base/common/async';
import { resolveMachineId, resolveSqmId, resolveVSDeviceId } from 'vs/platform/telemetry/electron-main/telemetryUtils';
import { resolveMachineId, resolveSqmId, resolvedevDeviceId } 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';
Expand Down Expand Up @@ -611,18 +611,18 @@ export class CodeApplication extends Disposable {

// Resolve unique machine ID
this.logService.trace('Resolving machine identifier...');
const [machineId, sqmId, vsDeviceId] = await Promise.all([
const [machineId, sqmId, devDeviceId] = await Promise.all([
resolveMachineId(this.stateService, this.logService),
resolveSqmId(this.stateService, this.logService),
resolveVSDeviceId(this.stateService, this.logService)
resolvedevDeviceId(this.stateService, this.logService)
]);
this.logService.trace(`Resolved machine identifier: ${machineId}`);

// Shared process
const { sharedProcessReady, sharedProcessClient } = this.setupSharedProcess(machineId, sqmId, vsDeviceId);
const { sharedProcessReady, sharedProcessClient } = this.setupSharedProcess(machineId, sqmId, devDeviceId);

// Services
const appInstantiationService = await this.initServices(machineId, sqmId, vsDeviceId, sharedProcessReady);
const appInstantiationService = await this.initServices(machineId, sqmId, devDeviceId, sharedProcessReady);

// Auth Handler
this._register(appInstantiationService.createInstance(ProxyAuthHandler));
Expand Down Expand Up @@ -987,8 +987,8 @@ export class CodeApplication extends Disposable {
return false;
}

private setupSharedProcess(machineId: string, sqmId: string, vsDeviceId: string): { sharedProcessReady: Promise<MessagePortClient>; sharedProcessClient: Promise<MessagePortClient> } {
const sharedProcess = this._register(this.mainInstantiationService.createInstance(SharedProcess, machineId, sqmId, vsDeviceId));
private setupSharedProcess(machineId: string, sqmId: string, devDeviceId: string): { sharedProcessReady: Promise<MessagePortClient>; sharedProcessClient: Promise<MessagePortClient> } {
const sharedProcess = this._register(this.mainInstantiationService.createInstance(SharedProcess, machineId, sqmId, devDeviceId));

this._register(sharedProcess.onDidCrash(() => this.windowsMainService?.sendToFocused('vscode:reportSharedProcessCrash')));

Expand All @@ -1011,7 +1011,7 @@ export class CodeApplication extends Disposable {
return { sharedProcessReady, sharedProcessClient };
}

private async initServices(machineId: string, sqmId: string, vsDeviceId: string, sharedProcessReady: Promise<MessagePortClient>): Promise<IInstantiationService> {
private async initServices(machineId: string, sqmId: string, devDeviceId: string, sharedProcessReady: Promise<MessagePortClient>): Promise<IInstantiationService> {
const services = new ServiceCollection();

// Update
Expand All @@ -1034,7 +1034,7 @@ export class CodeApplication extends Disposable {
}

// Windows
services.set(IWindowsMainService, new SyncDescriptor(WindowsMainService, [machineId, sqmId, vsDeviceId, this.userEnv], false));
services.set(IWindowsMainService, new SyncDescriptor(WindowsMainService, [machineId, sqmId, devDeviceId, this.userEnv], false));
services.set(IAuxiliaryWindowsMainService, new SyncDescriptor(AuxiliaryWindowsMainService, undefined, false));

// Dialogs
Expand Down Expand Up @@ -1114,7 +1114,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, sqmId, vsDeviceId, isInternal);
const commonProperties = resolveCommonProperties(release(), hostname(), process.arch, this.productService.commit, this.productService.version, machineId, sqmId, devDeviceId, isInternal);
const piiPaths = getPiiPathsFromEnvironment(this.environmentMainService);
const config: ITelemetryServiceConfig = { appenders: [appender], commonProperties, piiPaths, sendErrorTelemetry: true };

Expand Down
6 changes: 3 additions & 3 deletions src/vs/code/node/cliProcessMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, resolveSqmId, resolveVSDeviceId } from 'vs/platform/telemetry/node/telemetryUtils';
import { resolveMachineId, resolveSqmId, resolvedevDeviceId } 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';
Expand Down Expand Up @@ -186,7 +186,7 @@ class CliMain extends Disposable {
}
}
const sqmId = await resolveSqmId(stateService, logService);
const vsDeviceId = await resolveVSDeviceId(stateService, logService);
const devDeviceId = await resolvedevDeviceId(stateService, logService);

// Initialize user data profiles after initializing the state
userDataProfilesService.init();
Expand Down Expand Up @@ -222,7 +222,7 @@ class CliMain extends Disposable {
const config: ITelemetryServiceConfig = {
appenders,
sendErrorTelemetry: false,
commonProperties: resolveCommonProperties(release(), hostname(), process.arch, productService.commit, productService.version, machineId, sqmId, vsDeviceId, isInternal),
commonProperties: resolveCommonProperties(release(), hostname(), process.arch, productService.commit, productService.version, machineId, sqmId, devDeviceId, isInternal),
piiPaths: getPiiPathsFromEnvironment(environmentService)
};

Expand Down
2 changes: 1 addition & 1 deletion src/vs/code/node/sharedProcess/sharedProcessMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class SharedProcessMain extends Disposable implements IClientConnectionFilter {

telemetryService = new TelemetryService({
appenders,
commonProperties: resolveCommonProperties(release(), hostname(), process.arch, productService.commit, productService.version, this.configuration.machineId, this.configuration.sqmId, this.configuration.vsDeviceId, internalTelemetry),
commonProperties: resolveCommonProperties(release(), hostname(), process.arch, productService.commit, productService.version, this.configuration.machineId, this.configuration.sqmId, this.configuration.devDeviceId, internalTelemetry),
sendErrorTelemetry: true,
piiPaths: getPiiPathsFromEnvironment(environmentService),
}, configurationService, productService);
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/standalone/browser/standaloneServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ class StandaloneTelemetryService implements ITelemetryService {
readonly sessionId = 'someValue.sessionId';
readonly machineId = 'someValue.machineId';
readonly sqmId = 'someValue.sqmId';
readonly vsDeviceId = 'someValue.vsDeviceId';
readonly devDeviceId = 'someValue.devDeviceId';
readonly firstSessionDate = 'someValue.firstSessionDate';
readonly sendErrorTelemetry = false;
setEnabled(): void { }
Expand Down
4 changes: 2 additions & 2 deletions src/vs/platform/sharedProcess/electron-main/sharedProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class SharedProcess extends Disposable {
constructor(
private readonly machineId: string,
private readonly sqmId: string,
private readonly vsDeviceId: string,
private readonly devDeviceId: string,
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService,
@IUserDataProfilesService private readonly userDataProfilesService: IUserDataProfilesService,
@ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService,
Expand Down Expand Up @@ -181,7 +181,7 @@ export class SharedProcess extends Disposable {
return {
machineId: this.machineId,
sqmId: this.sqmId,
vsDeviceId: this.vsDeviceId,
devDeviceId: this.devDeviceId,
codeCachePath: this.environmentMainService.codeCachePath,
profiles: {
home: this.userDataProfilesService.profilesHome,
Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/sharedProcess/node/sharedProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface ISharedProcessConfiguration {

readonly sqmId: string;

readonly vsDeviceId: string;
readonly devDeviceId: string;

readonly codeCachePath: string | undefined;

Expand Down
6 changes: 3 additions & 3 deletions src/vs/platform/telemetry/common/commonProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function resolveCommonProperties(
version: string | undefined,
machineId: string | undefined,
sqmId: string | undefined,
vsDeviceId: string | undefined,
devDeviceId: string | undefined,
isInternalTelemetry: boolean,
product?: string
): ICommonProperties {
Expand All @@ -34,8 +34,8 @@ export function resolveCommonProperties(
result['common.machineId'] = machineId;
// __GDPR__COMMON__ "common.sqmId" : { "endPoint": "SqmMachineId", "classification": "EndUserPseudonymizedInformation", "purpose": "BusinessInsight" }
result['common.sqmId'] = sqmId;
// __GDPR__COMMON__ "common.vsDeviceId" : { "endPoint": "SqmMachineId", "classification": "EndUserPseudonymizedInformation", "purpose": "BusinessInsight" }
result['common.vsDeviceId'] = vsDeviceId;
// __GDPR__COMMON__ "common.devDeviceId" : { "endPoint": "SqmMachineId", "classification": "EndUserPseudonymizedInformation", "purpose": "BusinessInsight" }
result['common.devDeviceId'] = devDeviceId;
// __GDPR__COMMON__ "sessionID" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['sessionID'] = generateUuid() + Date.now();
// __GDPR__COMMON__ "commitHash" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
Expand Down
4 changes: 2 additions & 2 deletions src/vs/platform/telemetry/common/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface ITelemetryService {
readonly sessionId: string;
readonly machineId: string;
readonly sqmId: string;
readonly vsDeviceId: string;
readonly devDeviceId: string;
readonly firstSessionDate: string;
readonly msftInternal?: boolean;

Expand Down Expand Up @@ -74,7 +74,7 @@ export const firstSessionDateStorageKey = 'telemetry.firstSessionDate';
export const lastSessionDateStorageKey = 'telemetry.lastSessionDate';
export const machineIdKey = 'telemetry.machineId';
export const sqmIdKey = 'telemetry.sqmId';
export const vsDeviceIdKey = 'telemetry.vsDeviceId';
export const devDeviceIdKey = 'telemetry.devDeviceId';

// Configuration Keys
export const TELEMETRY_SECTION_ID = 'telemetry';
Expand Down
4 changes: 2 additions & 2 deletions src/vs/platform/telemetry/common/telemetryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class TelemetryService implements ITelemetryService {
readonly sessionId: string;
readonly machineId: string;
readonly sqmId: string;
readonly vsDeviceId: string;
readonly devDeviceId: string;
readonly firstSessionDate: string;
readonly msftInternal: boolean | undefined;

Expand All @@ -59,7 +59,7 @@ export class TelemetryService implements ITelemetryService {
this.sessionId = this._commonProperties['sessionID'] as string;
this.machineId = this._commonProperties['common.machineId'] as string;
this.sqmId = this._commonProperties['common.sqmId'] as string;
this.vsDeviceId = this._commonProperties['common.vsDeviceId'] as string;
this.devDeviceId = this._commonProperties['common.devDeviceId'] as string;
this.firstSessionDate = this._commonProperties['common.firstSessionDate'] as string;
this.msftInternal = this._commonProperties['common.msftInternal'] as boolean | undefined;

Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/telemetry/common/telemetryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class NullTelemetryServiceShape implements ITelemetryService {
readonly sessionId = 'someValue.sessionId';
readonly machineId = 'someValue.machineId';
readonly sqmId = 'someValue.sqmId';
readonly vsDeviceId = 'someValue.vsDeviceId';
readonly devDeviceId = 'someValue.devDeviceId';
readonly firstSessionDate = 'someValue.firstSessionDate';
readonly sendErrorTelemetry = false;
publicLog() { }
Expand Down
12 changes: 6 additions & 6 deletions src/vs/platform/telemetry/electron-main/telemetryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import { ILogService } from 'vs/platform/log/common/log';
import { IStateService } from 'vs/platform/state/node/state';
import { machineIdKey, sqmIdKey, vsDeviceIdKey } from 'vs/platform/telemetry/common/telemetry';
import { resolveMachineId as resolveNodeMachineId, resolveSqmId as resolveNodeSqmId, resolveVSDeviceId as resolveNodeVSDeviceId } from 'vs/platform/telemetry/node/telemetryUtils';
import { machineIdKey, sqmIdKey, devDeviceIdKey } from 'vs/platform/telemetry/common/telemetry';
import { resolveMachineId as resolveNodeMachineId, resolveSqmId as resolveNodeSqmId, resolvedevDeviceId as resolveNodedevDeviceId } from 'vs/platform/telemetry/node/telemetryUtils';

export async function resolveMachineId(stateService: IStateService, logService: ILogService): Promise<string> {
// Call the node layers implementation to avoid code duplication
Expand All @@ -21,8 +21,8 @@ export async function resolveSqmId(stateService: IStateService, logService: ILog
return sqmId;
}

export async function resolveVSDeviceId(stateService: IStateService, logService: ILogService): Promise<string> {
const vsDeviceId = await resolveNodeVSDeviceId(stateService, logService);
stateService.setItem(vsDeviceIdKey, vsDeviceId);
return vsDeviceId;
export async function resolvedevDeviceId(stateService: IStateService, logService: ILogService): Promise<string> {
const devDeviceId = await resolveNodedevDeviceId(stateService, logService);
stateService.setItem(devDeviceIdKey, devDeviceId);
return devDeviceId;
}
14 changes: 7 additions & 7 deletions src/vs/platform/telemetry/node/telemetryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
*--------------------------------------------------------------------------------------------*/

import { isMacintosh } from 'vs/base/common/platform';
import { getMachineId, getSqmMachineId, getVSDeviceId } from 'vs/base/node/id';
import { getMachineId, getSqmMachineId, getdevDeviceId } from 'vs/base/node/id';
import { ILogService } from 'vs/platform/log/common/log';
import { IStateReadService } from 'vs/platform/state/node/state';
import { machineIdKey, sqmIdKey, vsDeviceIdKey } from 'vs/platform/telemetry/common/telemetry';
import { machineIdKey, sqmIdKey, devDeviceIdKey } from 'vs/platform/telemetry/common/telemetry';


export async function resolveMachineId(stateService: IStateReadService, logService: ILogService): Promise<string> {
Expand All @@ -30,11 +30,11 @@ export async function resolveSqmId(stateService: IStateReadService, logService:
return sqmId;
}

export async function resolveVSDeviceId(stateService: IStateReadService, logService: ILogService): Promise<string> {
let vsDeviceId = stateService.getItem<string>(vsDeviceIdKey);
if (typeof vsDeviceId !== 'string') {
vsDeviceId = await getVSDeviceId(logService.error.bind(logService));
export async function resolvedevDeviceId(stateService: IStateReadService, logService: ILogService): Promise<string> {
let devDeviceId = stateService.getItem<string>(devDeviceIdKey);
if (typeof devDeviceId !== 'string') {
devDeviceId = await getdevDeviceId(logService.error.bind(logService));
}

return vsDeviceId;
return devDeviceId;
}
2 changes: 1 addition & 1 deletion src/vs/platform/window/common/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ export interface INativeWindowConfiguration extends IWindowConfiguration, Native

machineId: string;
sqmId: string;
vsDeviceId: string;
devDeviceId: string;

execPath: string;
backupPath?: string;
Expand Down
4 changes: 2 additions & 2 deletions src/vs/platform/windows/electron-main/windowsMainService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
constructor(
private readonly machineId: string,
private readonly sqmId: string,
private readonly vsDeviceId: string,
private readonly devDeviceId: string,
private readonly initialUserEnv: IProcessEnvironment,
@ILogService private readonly logService: ILogService,
@ILoggerMainService private readonly loggerService: ILoggerMainService,
Expand Down Expand Up @@ -1410,7 +1410,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic

machineId: this.machineId,
sqmId: this.sqmId,
vsDeviceId: this.vsDeviceId,
devDeviceId: this.devDeviceId,

windowId: -1, // Will be filled in by the window once loaded later

Expand Down
8 changes: 4 additions & 4 deletions src/vs/server/node/serverServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { DisposableStore, toDisposable } from 'vs/base/common/lifecycle';
import { Schemas } from 'vs/base/common/network';
import * as path from 'vs/base/common/path';
import { IURITransformer } from 'vs/base/common/uriIpc';
import { getMachineId, getSqmMachineId, getVSDeviceId } from 'vs/base/node/id';
import { getMachineId, getSqmMachineId, getdevDeviceId } from 'vs/base/node/id';
import { Promises } from 'vs/base/node/pfs';
import { ClientConnectionEvent, IMessagePassingProtocol, IPCServer, StaticRouter } from 'vs/base/parts/ipc/common/ipc';
import { ProtocolConstants } from 'vs/base/parts/ipc/common/ipc.net';
Expand Down Expand Up @@ -132,12 +132,12 @@ export async function setupServerServices(connectionToken: ServerConnectionToken
socketServer.registerChannel('userDataProfiles', new RemoteUserDataProfilesServiceChannel(userDataProfilesService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority)));

// Initialize
const [, , machineId, sqmId, vsDeviceId] = await Promise.all([
const [, , machineId, sqmId, devDeviceId] = await Promise.all([
configurationService.initialize(),
userDataProfilesService.init(),
getMachineId(logService.error.bind(logService)),
getSqmMachineId(logService.error.bind(logService)),
getVSDeviceId(logService.error.bind(logService))
getdevDeviceId(logService.error.bind(logService))
]);

const extensionHostStatusService = new ExtensionHostStatusService();
Expand All @@ -157,7 +157,7 @@ export async function setupServerServices(connectionToken: ServerConnectionToken

const config: ITelemetryServiceConfig = {
appenders: [oneDsAppender],
commonProperties: resolveCommonProperties(release(), hostname(), process.arch, productService.commit, productService.version + '-remote', machineId, sqmId, vsDeviceId, isInternal, 'remoteAgent'),
commonProperties: resolveCommonProperties(release(), hostname(), process.arch, productService.commit, productService.version + '-remote', machineId, sqmId, devDeviceId, isInternal, 'remoteAgent'),
piiPaths: getPiiPathsFromEnvironment(environmentService)
};
const initialTelemetryLevelArg = environmentService.args['telemetry-level'];
Expand Down
Loading
Loading