提交 32681611 编写于 作者: K kieferrm 提交者: Kai Maetzel

classify common properties

上级 43c99472
......@@ -109,6 +109,7 @@ function main(server: Server, initData: ISharedProcessInitData): void {
const config: ITelemetryServiceConfig = {
appender,
commonProperties: resolveCommonProperties(product.commit, pkg.version, installSource)
// __GDPR__COMMON__ "common.machineId" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
.then(result => Object.defineProperty(result, 'common.machineId', {
get: () => storageService.get(machineIdStorageKey),
enumerable: true
......
......@@ -295,6 +295,7 @@ export class CodeApplication {
const channel = getDelayedChannel<ITelemetryAppenderChannel>(this.sharedProcessClient.then(c => c.getChannel('telemetryAppender')));
const appender = new TelemetryAppenderClient(channel);
const commonProperties = resolveCommonProperties(product.commit, pkg.version, this.environmentService.installSource)
// __GDPR__COMMON__ "common.machineId" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
.then(result => Object.defineProperty(result, 'common.machineId', {
get: () => this.storageService.getItem(machineIdStorageKey),
enumerable: true
......
......@@ -14,12 +14,19 @@ export const machineIdIpcChannel = 'vscode:machineId';
export function resolveCommonProperties(commit: string, version: string, source: string): TPromise<{ [name: string]: string; }> {
const result: { [name: string]: string; } = Object.create(null);
// __GDPR__COMMON__ "sessionID" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['sessionID'] = uuid.generateUuid() + Date.now();
// __GDPR__COMMON__ "commitHash" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['commitHash'] = commit;
// __GDPR__COMMON__ "version" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['version'] = version;
// __GDPR__COMMON__ "common.osVersion" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['common.osVersion'] = os.release();
// __GDPR__COMMON__ "common.platfrom" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['common.platform'] = Platform.Platform[Platform.platform];
// __GDPR__COMMON__ "common.nodePlatform" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['common.nodePlatform'] = process.platform;
// __GDPR__COMMON__ "common.nodeArch" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['common.nodeArch'] = process.arch;
result['common.source'] = source;
......@@ -27,14 +34,17 @@ export function resolveCommonProperties(commit: string, version: string, source:
let seq = 0;
const startTime = Date.now();
Object.defineProperties(result, {
// __GDPR__COMMON__ "timestamp" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
'timestamp': {
get: () => new Date(),
enumerable: true
},
// __GDPR__COMMON__ "common.timesincesessionstart" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
'common.timesincesessionstart': {
get: () => Date.now() - startTime,
enumerable: true
},
// __GDPR__COMMON__ "common.sequence" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
'common.sequence': {
get: () => seq++,
enumerable: true
......
......@@ -16,8 +16,11 @@ const SQM_KEY: string = '\\Software\\Microsoft\\SQMClient';
export function resolveWorkbenchCommonProperties(storageService: IStorageService, commit: string, version: string, source: string): TPromise<{ [name: string]: string }> {
return resolveCommonProperties(commit, version, source).then(result => {
// __GDPR__COMMON__ "common.version.shell" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['common.version.shell'] = process.versions && (<any>process).versions['electron'];
// __GDPR__COMMON__ "common.version.renderer" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['common.version.renderer'] = process.versions && (<any>process).versions['chrome'];
// __GDPR__COMMON__ "common.osVersion" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['common.osVersion'] = os.release();
const lastSessionDate = storageService.get('telemetry.lastSessionDate');
......@@ -25,16 +28,23 @@ export function resolveWorkbenchCommonProperties(storageService: IStorageService
storageService.store('telemetry.firstSessionDate', firstSessionDate);
storageService.store('telemetry.lastSessionDate', new Date().toUTCString());
// __GDPR__COMMON__ "common.firstSessionDate" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['common.firstSessionDate'] = firstSessionDate;
// __GDPR__COMMON__ "common.lastSessionDate" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['common.lastSessionDate'] = lastSessionDate;
// __GDPR__COMMON__ "common.isNewSession" : { "endPoint": "none", "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['common.isNewSession'] = !lastSessionDate ? '1' : '0';
const promises: TPromise<any>[] = [];
// __GDPR__COMMON__ "common.instanceId" : { "endPoint": "none", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
promises.push(getOrCreateInstanceId(storageService).then(value => result['common.instanceId'] = value));
// __GDPR__COMMON__ "common.machineId" : { "endPoint": "none", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
promises.push(getOrCreateMachineId(storageService).then(value => result['common.machineId'] = value));
if (process.platform === 'win32') {
// __GDPR__COMMON__ "common.sqm.userid" : { "endPoint": "SqmUserId", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
promises.push(getSqmUserId(storageService).then(value => result['common.sqm.userid'] = value));
// __GDPR__COMMON__ "common.sqm.machineid" : { "endPoint": "SqmMachineId", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
promises.push(getSqmMachineId(storageService).then(value => result['common.sqm.machineid'] = value));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册