diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts index 47aba50532..d863292909 100644 --- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts @@ -70,7 +70,7 @@ interface ISharedProcessInitData { logLevel: LogLevel; } -const eventPrefix = 'monacoworkbench'; +const eventPrefix = product.quality !== 'stable' ? 'adsworkbench' : 'monacoworkbench'; // {{ SQL CARBON EDIT }} class MainProcessService implements IMainProcessService { constructor(private server: Server, private mainRouter: StaticRouter) { } diff --git a/src/vs/code/node/cliProcessMain.ts b/src/vs/code/node/cliProcessMain.ts index 01ed93aa52..17a4b1a2e9 100644 --- a/src/vs/code/node/cliProcessMain.ts +++ b/src/vs/code/node/cliProcessMain.ts @@ -302,7 +302,7 @@ export class Main { } } -const eventPrefix = 'monacoworkbench'; +const eventPrefix = product.quality !== 'stable' ? 'adsworkbench' : 'monacoworkbench'; export async function main(argv: ParsedArgs): Promise { const services = new ServiceCollection(); diff --git a/src/vs/platform/telemetry/node/commonProperties.ts b/src/vs/platform/telemetry/node/commonProperties.ts index 54f168d766..bd89b471fc 100644 --- a/src/vs/platform/telemetry/node/commonProperties.ts +++ b/src/vs/platform/telemetry/node/commonProperties.ts @@ -14,15 +14,25 @@ const productObject = product; export async function resolveCommonProperties(commit: string | undefined, version: string | undefined, machineId: string | undefined, installSourcePath: string, product?: string): Promise<{ [name: string]: string | undefined; }> { const result: { [name: string]: string | undefined; } = Object.create(null); - // {{SQL CARBON EDIT}} - // __GDPR__COMMON__ "common.machineId" : { "endPoint": "MacAddressHash", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" } - result['common.machineId'] = ''; - // __GDPR__COMMON__ "sessionID" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } - result['sessionID'] = ''; + if (productObject.quality !== 'stable') { + // __GDPR__COMMON__ "common.machineId" : { "endPoint": "MacAddressHash", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" } + result['common.machineId'] = machineId; + // __GDPR__COMMON__ "sessionID" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + result['sessionID'] = uuid.generateUuid() + Date.now(); + // __GDPR__COMMON__ "commitHash" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } + result['commitHash'] = commit; + } else { + // __GDPR__COMMON__ "common.machineId" : { "endPoint": "MacAddressHash", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" } + // result['common.machineId'] = machineId; + result['common.machineId'] = ''; + // // __GDPR__COMMON__ "sessionID" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + // result['sessionID'] = uuid.generateUuid() + Date.now(); + result['sessionID'] = ''; + // __GDPR__COMMON__ "commitHash" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + result['commitHash'] = ''; + } - // __GDPR__COMMON__ "commitHash" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } - result['commitHash'] = ''; // __GDPR__COMMON__ "version" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } result['version'] = version; // __GDPR__COMMON__ "common.platformVersion" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } @@ -34,9 +44,8 @@ export async function resolveCommonProperties(commit: string | undefined, versio // __GDPR__COMMON__ "common.nodeArch" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } result['common.nodeArch'] = process.arch; // __GDPR__COMMON__ "common.product" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } - // {{SQL CARBON EDIT}} - result['common.product'] = productObject.nameShort || 'desktop'; - result['common.application.name'] = productObject.nameLong; + result['common.product'] = productObject.nameShort || 'desktop'; // {{SQL CARBON EDIT}} + result['common.application.name'] = productObject.nameLong; // {{SQL CARBON EDIT}} // dynamic properties which value differs on each call let seq = 0; diff --git a/src/vs/platform/telemetry/node/workbenchCommonProperties.ts b/src/vs/platform/telemetry/node/workbenchCommonProperties.ts index f8e2f0877d..ad9a8dedb9 100644 --- a/src/vs/platform/telemetry/node/workbenchCommonProperties.ts +++ b/src/vs/platform/telemetry/node/workbenchCommonProperties.ts @@ -8,8 +8,7 @@ import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProper import { instanceStorageKey, firstSessionDateStorageKey, lastSessionDateStorageKey } from 'vs/platform/telemetry/common/telemetry'; import { cleanRemoteAuthority } from 'vs/platform/telemetry/common/telemetryUtils'; -// {{ SQL CARBON EDIT }} -import product from 'vs/platform/product/node/product'; +import product from 'vs/platform/product/node/product'; // {{ SQL CARBON EDIT }} export async function resolveWorkbenchCommonProperties(storageService: IStorageService, commit: string | undefined, version: string | undefined, machineId: string, installSourcePath: string, remoteAuthority?: string): Promise<{ [name: string]: string | undefined }> { const result = await resolveCommonProperties(commit, version, machineId, installSourcePath); @@ -17,27 +16,41 @@ export async function resolveWorkbenchCommonProperties(storageService: IStorageS const firstSessionDate = storageService.get(firstSessionDateStorageKey, StorageScope.GLOBAL)!; const lastSessionDate = storageService.get(lastSessionDateStorageKey, StorageScope.GLOBAL)!; - // __GDPR__COMMON__ "common.version.shell" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } - // result['common.version.shell'] = process.versions && process.versions['electron']; - // __GDPR__COMMON__ "common.version.renderer" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } - // result['common.version.renderer'] = process.versions && process.versions['chrome']; - // __GDPR__COMMON__ "common.firstSessionDate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } - // result['common.firstSessionDate'] = firstSessionDate; - // __GDPR__COMMON__ "common.lastSessionDate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } - // result['common.lastSessionDate'] = lastSessionDate || ''; - // __GDPR__COMMON__ "common.isNewSession" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } - // result['common.isNewSession'] = !lastSessionDate ? '1' : '0'; - // __GDPR__COMMON__ "common.instanceId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } - // result['common.instanceId'] = instanceId; - // __GDPR__COMMON__ "common.remoteAuthority" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } - // result['common.remoteAuthority'] = cleanRemoteAuthority(remoteAuthority); + if (product.quality !== 'stable') { + // __GDPR__COMMON__ "common.version.shell" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } + result['common.version.shell'] = process.versions && process.versions['electron']; + // __GDPR__COMMON__ "common.version.renderer" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } + result['common.version.renderer'] = process.versions && process.versions['chrome']; + // __GDPR__COMMON__ "common.firstSessionDate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + result['common.firstSessionDate'] = firstSessionDate; + // __GDPR__COMMON__ "common.lastSessionDate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + result['common.lastSessionDate'] = lastSessionDate || ''; + // __GDPR__COMMON__ "common.isNewSession" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + result['common.isNewSession'] = !lastSessionDate ? '1' : '0'; + // __GDPR__COMMON__ "common.instanceId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + result['common.instanceId'] = instanceId; + // __GDPR__COMMON__ "common.remoteAuthority" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } + result['common.remoteAuthority'] = cleanRemoteAuthority(remoteAuthority); + } else { + // __GDPR__COMMON__ "common.version.shell" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } + // result['common.version.shell'] = process.versions && process.versions['electron']; + // __GDPR__COMMON__ "common.version.renderer" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } + // result['common.version.renderer'] = process.versions && process.versions['chrome']; + // __GDPR__COMMON__ "common.firstSessionDate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + // result['common.firstSessionDate'] = firstSessionDate; + // __GDPR__COMMON__ "common.lastSessionDate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + // result['common.lastSessionDate'] = lastSessionDate || ''; + // __GDPR__COMMON__ "common.isNewSession" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + // result['common.isNewSession'] = !lastSessionDate ? '1' : '0'; + // __GDPR__COMMON__ "common.instanceId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + // result['common.instanceId'] = instanceId; + // __GDPR__COMMON__ "common.remoteAuthority" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } + // result['common.remoteAuthority'] = cleanRemoteAuthority(remoteAuthority); - // {{SQL CARBON EDIT}} - result['common.application.name'] = product.nameLong; - // {{SQL CARBON EDIT}} - result['common.userId'] = ''; + result['common.userId'] = ''; // {{SQL CARBON EDIT}} + } - // {{SQL CARBON EDIT}} + result['common.application.name'] = product.nameLong; // {{SQL CARBON EDIT}} setUsageDates(storageService); return result; diff --git a/src/vs/workbench/services/telemetry/browser/telemetryService.ts b/src/vs/workbench/services/telemetry/browser/telemetryService.ts index 3d3c40d08e..09590df331 100644 --- a/src/vs/workbench/services/telemetry/browser/telemetryService.ts +++ b/src/vs/workbench/services/telemetry/browser/telemetryService.ts @@ -20,7 +20,8 @@ import { ApplicationInsights } from '@microsoft/applicationinsights-web'; export class WebTelemetryAppender implements ITelemetryAppender { private _aiClient?: ApplicationInsights; - constructor(aiKey: string, private _logService: ILogService) { + constructor(aiKey: string, private _logService: ILogService + , @IWorkbenchEnvironmentService private _environmentService: IWorkbenchEnvironmentService) { // {{ SQL CARBON EDIT }} const initConfig = { config: { instrumentationKey: aiKey, @@ -44,8 +45,10 @@ export class WebTelemetryAppender implements ITelemetryAppender { data = validateTelemetryData(data); this._logService.trace(`telemetry/${eventName}`, data); + // {{ SQL CARBON EDIT }} + const eventPrefix = this._environmentService.appQuality !== 'stable' ? 'adsworkbench/' : 'monacoworkbench/'; this._aiClient.trackEvent({ - name: 'monacoworkbench/' + eventName, + name: eventPrefix + eventName, properties: data.properties, measurements: data.measurements }); @@ -82,7 +85,7 @@ export class TelemetryService extends Disposable implements ITelemetryService { const aiKey = productService.aiConfig && productService.aiConfig.asimovKey; if (!environmentService.isExtensionDevelopment && !environmentService.args['disable-telemetry'] && !!productService.enableTelemetry && !!aiKey) { const config: ITelemetryServiceConfig = { - appender: combinedAppender(new WebTelemetryAppender(aiKey, logService), new LogAppender(logService)), + appender: combinedAppender(new WebTelemetryAppender(aiKey, logService, environmentService), new LogAppender(logService)), commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, environmentService.configuration.machineId, environmentService.configuration.remoteAuthority), piiPaths: [environmentService.appRoot] };