Skip to content

Commit c08cfdf

Browse files
author
Rachel Macfarlane
committed
Move cleanRemoteAuthority function to common location
1 parent 5d49ab2 commit c08cfdf

3 files changed

Lines changed: 18 additions & 31 deletions

File tree

src/vs/platform/telemetry/browser/workbenchCommonProperties.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const lastSessionDateStorageKey = 'telemetry.lastSessionDate';
1212

1313
import * as Platform from 'vs/base/common/platform';
1414
import * as uuid from 'vs/base/common/uuid';
15+
import { cleanRemoteAuthority } from 'vs/platform/telemetry/common/telemetryUtils';
1516

1617
export async function resolveWorkbenchCommonProperties(storageService: IStorageService, commit: string | undefined, version: string | undefined, machineId: string, remoteAuthority?: string): Promise<{ [name: string]: string | undefined }> {
1718
const result: { [name: string]: string | undefined; } = Object.create(null);
@@ -69,18 +70,3 @@ export async function resolveWorkbenchCommonProperties(storageService: IStorageS
6970
return result;
7071
}
7172

72-
function cleanRemoteAuthority(remoteAuthority?: string): string {
73-
if (!remoteAuthority) {
74-
return 'none';
75-
}
76-
77-
let ret = 'other';
78-
// Whitelisted remote authorities
79-
['ssh-remote', 'dev-container', 'attached-container', 'wsl'].forEach((res: string) => {
80-
if (remoteAuthority!.indexOf(`${res}+`) === 0) {
81-
ret = res;
82-
}
83-
});
84-
85-
return ret;
86-
}

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,22 @@ export function validateTelemetryData(data?: any): { properties: Properties, mea
288288
};
289289
}
290290

291+
export function cleanRemoteAuthority(remoteAuthority?: string): string {
292+
if (!remoteAuthority) {
293+
return 'none';
294+
}
295+
296+
let ret = 'other';
297+
// Whitelisted remote authorities
298+
['ssh-remote', 'dev-container', 'attached-container', 'wsl'].forEach((res: string) => {
299+
if (remoteAuthority!.indexOf(`${res}+`) === 0) {
300+
ret = res;
301+
}
302+
});
303+
304+
return ret;
305+
}
306+
291307
function flatten(obj: any, result: { [key: string]: any }, order: number = 0, prefix?: string): void {
292308
if (!obj) {
293309
return;

src/vs/platform/telemetry/node/workbenchCommonProperties.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
77
import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties';
88
import { instanceStorageKey, firstSessionDateStorageKey, lastSessionDateStorageKey } from 'vs/platform/telemetry/common/telemetry';
9+
import { cleanRemoteAuthority } from 'vs/platform/telemetry/common/telemetryUtils';
910

1011
export async function resolveWorkbenchCommonProperties(storageService: IStorageService, commit: string | undefined, version: string | undefined, machineId: string, installSourcePath: string, remoteAuthority?: string): Promise<{ [name: string]: string | undefined }> {
1112
const result = await resolveCommonProperties(commit, version, machineId, installSourcePath);
@@ -30,19 +31,3 @@ export async function resolveWorkbenchCommonProperties(storageService: IStorageS
3031

3132
return result;
3233
}
33-
34-
function cleanRemoteAuthority(remoteAuthority?: string): string {
35-
if (!remoteAuthority) {
36-
return 'none';
37-
}
38-
39-
let ret = 'other';
40-
// Whitelisted remote authorities
41-
['ssh-remote', 'dev-container', 'wsl'].forEach((res: string) => {
42-
if (remoteAuthority!.indexOf(`${res}+`) === 0) {
43-
ret = res;
44-
}
45-
});
46-
47-
return ret;
48-
}

0 commit comments

Comments
 (0)