Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sent string value in telemetry #204457

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,12 @@ class ConfigurationTelemetryContribution extends Disposable implements IWorkbenc
/**
* Report value of a setting only if it is an enum, boolean, or number or an array of those.
*/
private getValueToReport(key: string, target: ConfigurationTarget.USER_LOCAL | ConfigurationTarget.WORKSPACE): any {
private getValueToReport(key: string, target: ConfigurationTarget.USER_LOCAL | ConfigurationTarget.WORKSPACE): string | undefined {
const schema = this.configurationRegistry.getConfigurationProperties()[key];
const inpsectData = this.configurationService.inspect(key);
const value = target === ConfigurationTarget.USER_LOCAL ? inpsectData.user?.value : inpsectData.workspace?.value;
if (isNumber(value) || isBoolean(value)) {
return value;
return value.toString();
}
if (isString(value)) {
if (schema?.enum?.includes(value)) {
Expand All @@ -296,15 +296,15 @@ class ConfigurationTelemetryContribution extends Disposable implements IWorkbenc
}
if (Array.isArray(value)) {
if (value.every(v => isNumber(v) || isBoolean(v) || (isString(v) && schema?.enum?.includes(v)))) {
return value;
return JSON.stringify(value);
}
}
return undefined;
}

private reportTelemetry(key: string, target: ConfigurationTarget.USER_LOCAL | ConfigurationTarget.WORKSPACE): void {
type UpdatedSettingEvent = {
value: any;
value: string | undefined;
source: string;
};
const source = ConfigurationTargetToString(target);
Expand Down