remove telemetry prop: common.source (#176688)

* remove telemetry prop: common.source

* remove extra code

* use interface

* use interface again

* fix tests
This commit is contained in:
João Moreno
2023-03-10 15:22:27 +01:00
committed by GitHub
parent d7014b6a6c
commit 5bb3880b20
39 changed files with 327 additions and 498 deletions
+11 -24
View File
@@ -5,7 +5,6 @@
import { hostname, release } from 'os';
import { raceTimeout } from 'vs/base/common/async';
import { VSBuffer } from 'vs/base/common/buffer';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { isSigPipeError, onUnexpectedError, setUnexpectedErrorHandler } from 'vs/base/common/errors';
import { Disposable } from 'vs/base/common/lifecycle';
@@ -171,6 +170,16 @@ class CliMain extends Disposable {
configurationService.initialize()
]);
// Get machine ID
let machineId: string | undefined = undefined;
try {
machineId = await resolveMachineId(stateService, logService);
} catch (error) {
if (error.code !== 'ENOENT') {
logService.error(error);
}
}
// Initialize user data profiles after initializing the state
userDataProfilesService.init();
@@ -201,23 +210,10 @@ class CliMain extends Disposable {
appenders.push(new OneDataSystemAppender(isInternal, 'monacoworkbench', null, productService.aiConfig.ariaKey));
}
const { installSourcePath } = environmentService;
const config: ITelemetryServiceConfig = {
appenders,
sendErrorTelemetry: false,
commonProperties: (async () => {
let machineId: string | undefined = undefined;
try {
machineId = await resolveMachineId(stateService, logService);
} catch (error) {
if (error.code !== 'ENOENT') {
logService.error(error);
}
}
return resolveCommonProperties(fileService, release(), hostname(), process.arch, productService.commit, productService.version, machineId, isInternal, installSourcePath);
})(),
commonProperties: resolveCommonProperties(release(), hostname(), process.arch, productService.commit, productService.version, machineId, isInternal),
piiPaths: getPiiPathsFromEnvironment(environmentService)
};
@@ -261,11 +257,6 @@ class CliMain extends Disposable {
}
const profileLocation = (profile ?? userDataProfilesService.defaultProfile).extensionsResource;
// Install Source
if (this.argv['install-source']) {
return this.setInstallSource(environmentService, fileService, this.argv['install-source']);
}
// List Extensions
if (this.argv['list-extensions']) {
return instantiationService.createInstance(ExtensionManagementCLI, new ConsoleLogger(LogLevel.Info, false)).listExtensions(!!this.argv['show-versions'], this.argv['category'], profileLocation);
@@ -296,10 +287,6 @@ class CliMain extends Disposable {
private asExtensionIdOrVSIX(inputs: string[]): (string | URI)[] {
return inputs.map(input => /\.vsix$/i.test(input) ? URI.file(isAbsolute(input) ? input : join(cwd(), input)) : input);
}
private async setInstallSource(environmentService: INativeEnvironmentService, fileService: IFileService, installSource: string): Promise<void> {
await fileService.writeFile(URI.file(environmentService.installSourcePath), VSBuffer.fromString(installSource.slice(0, 30)));
}
}
export async function main(argv: NativeParsedArgs): Promise<void> {