Skip to content

Commit

Permalink
Merge pull request #180 from microsoft/aiday/sendTelemetryValueNotPro…
Browse files Browse the repository at this point in the history
…perty

Send the value assigned to the telemetry property key not the property key itself
  • Loading branch information
lramos15 authored Aug 24, 2023
2 parents e531918 + fc3d4d0 commit 45b6230
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/common/baseTelemetryReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ export class BaseTelemetryReporter {
*/
public sendRawTelemetryEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void {
const modifiedProperties = { ...properties };
for (const property of Object.keys(modifiedProperties ?? {})) {
if (typeof property === "string") {
for (const propertyKey of Object.keys(modifiedProperties ?? {})) {
const propertyValue = modifiedProperties[propertyKey];
if (typeof propertyKey === "string" && propertyValue !== undefined) {
// Trusted values are not sanitized, which is what we want for raw telemetry
modifiedProperties[property] = new this.vscodeAPI.TelemetryTrustedValue<string>(property);
modifiedProperties[propertyKey] = new this.vscodeAPI.TelemetryTrustedValue<string>(typeof propertyValue === 'string' ? propertyValue : propertyValue.value);
}
}

Expand Down

0 comments on commit 45b6230

Please sign in to comment.