src/vs/platform/telemetry/common/commonProperties.ts

108 LOC · 93 covered · 15 uncovered · 10 ranges · 5171 concepts · 3 introducers · 2777 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- telemetryUtils.ts ×15
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { isLinuxSnap, platform, Platform, PlatformToString } from '../../../base/common/platform.js';
7 > import { env, platform as nodePlatform } from '../../../base/common/process.js';
8 > import { generateUuid } from '../../../base/common/uuid.js';
9 > import { ICommonProperties } from './telemetry.js';
10 >
11 > function getPlatformDetail(hostname: string): string | undefined { commonProperties.ts ×6
12 > if (platform === Platform.Linux && /^penguin(\.|$)/i.test(hostname)) {
13 return 'chromebook';
14 }
16 > return undefined;
17 > }
19 > export function resolveCommonProperties(
20 > release: string, commonProperties.ts ×6
21 > hostname: string,
22 > arch: string,
23 > commit: string | undefined,
24 > version: string | undefined,
25 > machineId: string | undefined,
26 > sqmId: string | undefined,
27 > devDeviceId: string | undefined,
28 > isInternalTelemetry: boolean,
29 > releaseDate: string | undefined,
30 > product?: string,
31 > ): ICommonProperties {
32 > const result: ICommonProperties = Object.create(null);
33 >
34 > // __GDPR__COMMON__ "common.machineId" : { "endPoint": "MacAddressHash", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
35 > result['common.machineId'] = machineId;
36 > // __GDPR__COMMON__ "common.sqmId" : { "endPoint": "SqmMachineId", "classification": "EndUserPseudonymizedInformation", "purpose": "BusinessInsight" }
37 > result['common.sqmId'] = sqmId;
38 > // __GDPR__COMMON__ "common.devDeviceId" : { "endPoint": "SqmMachineId", "classification": "EndUserPseudonymizedInformation", "purpose": "BusinessInsight" }
39 > result['common.devDeviceId'] = devDeviceId;
40 > // __GDPR__COMMON__ "sessionID" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
41 > result['sessionID'] = generateUuid() + Date.now();
42 > // __GDPR__COMMON__ "commitHash" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
43 > result['commitHash'] = commit;
44 > // __GDPR__COMMON__ "version" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
45 > result['version'] = version;
46 > // __GDPR__COMMON__ "common.releaseDate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
47 > result['common.releaseDate'] = releaseDate;
48 > // __GDPR__COMMON__ "common.platformVersion" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
49 > result['common.platformVersion'] = (release || '').replace(/^(\d+)(\.\d+)?(\.\d+)?(.*)/, '$1$2$3');
50 > // __GDPR__COMMON__ "common.platform" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
51 > result['common.platform'] = PlatformToString(platform);
52 > // __GDPR__COMMON__ "common.nodePlatform" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
53 > result['common.nodePlatform'] = nodePlatform;
54 > // __GDPR__COMMON__ "common.nodeArch" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
55 > result['common.nodeArch'] = arch;
56 > // __GDPR__COMMON__ "common.product" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
57 > result['common.product'] = product || 'desktop';
58 >
59 > if (isInternalTelemetry) {
60 // __GDPR__COMMON__ "common.msftInternal" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
61 result['common.msftInternal'] = isInternalTelemetry;
62 }
64 > // dynamic properties which value differs on each call
65 > let seq = 0;
66 > const startTime = Date.now();
67 > Object.defineProperties(result, {
68 > // __GDPR__COMMON__ "timestamp" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
69 > 'timestamp': {
70 > get: () => new Date(),
71 > enumerable: true
72 > },
73 > // __GDPR__COMMON__ "common.timesincesessionstart" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
74 > 'common.timesincesessionstart': {
75 > get: () => Date.now() - startTime,
76 > enumerable: true
77 > },
78 > // __GDPR__COMMON__ "common.sequence" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
79 > 'common.sequence': {
80 > get: () => seq++,
81 > enumerable: true
82 > }
83 > });
84 >
85 > if (isLinuxSnap) {
86 // __GDPR__COMMON__ "common.snap" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
87 result['common.snap'] = 'true';
88 }
90 > const platformDetail = getPlatformDetail(hostname);
91 >
92 > if (platformDetail) {
93 // __GDPR__COMMON__ "common.platformDetail" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
94 result['common.platformDetail'] = platformDetail;
95 }
97 > return result;
98 > }
100 > export function verifyMicrosoftInternalDomain(domainList: readonly string[]): boolean {
101 > const userDnsDomain = env['USERDNSDOMAIN']; telemetryService.ts ×9
102 > if (!userDnsDomain) {
103 > return false;
104 > }
105
106 const domain = userDnsDomain.toLowerCase();
107 return domainList.some(msftDomain => domain === msftDomain);
108 }