Skip to content

Commit

Permalink
sent string value in telemetry (#204457)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 authored Feb 6, 2024
1 parent 2738725 commit 8839e62
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 8839e62

Please sign in to comment.