Skip to content

Commit cdbf326

Browse files
committed
Get rid of error props
1 parent c095592 commit cdbf326

File tree

2 files changed

+9
-22
lines changed

2 files changed

+9
-22
lines changed

lib/telemetryReporter.d.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,24 +73,22 @@ export default class TelemetryReporter {
7373
sendDangerousTelemetryEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements, sanitize?: boolean): void;
7474

7575
/**
76-
* Sends a telemetry error event with the given properties, measurements, and errorProps
76+
* Sends a telemetry error event with the given properties, measurements
7777
* @param eventName The name of the event
7878
* @param properties The set of properties to add to the event in the form of a string key value pair
7979
* @param measurements The set of measurements to add to the event in the form of a string key number value pair
80-
* @param errorProps A list of case sensitive properties to drop, if excluded we drop all properties but still send the event
8180
*/
82-
sendTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements, errorProps?: string[]): void;
81+
sendTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void;
8382

8483
/**
8584
* **DANGEROUS** Given an event name, some properties, and measurements sends a telemetry error event without checking telemetry setting
8685
* Do not use unless in a controlled environment i.e. sending telmetry from a CI pipeline or testing during development
8786
* @param eventName The name of the event
8887
* @param properties The properties to send with the event
8988
* @param measurements The measurements (numeric values) to send with the event
90-
* @param errorProps If not present then we assume all properties belong to the error prop and will be anonymized
9189
* @param sanitize Whether or not to run the properties and measures through sanitiziation, defaults to true
9290
*/
93-
sendDangerousTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements, errorProps?: string[], sanitize?: boolean): void;
91+
sendDangerousTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements, sanitize?: boolean): void;
9492

9593
/**
9694
* Sends an exception which includes the error stack, properties, and measurements

src/common/baseTelemetryReporter.ts

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -349,31 +349,22 @@ export class BaseTelemetryReporter {
349349
* @param eventName The name of the event
350350
* @param properties The properties of the event
351351
* @param measurements The measurements (numeric values) to send with the event
352-
* @param errorProps Properties to readct. If undefined then we assume all properties belong to the error prop and will be anonymized
353352
* @param sanitize Whether or not to sanitize to the properties and measures
354353
* @param dangerous Whether or not to ignore telemetry level
355354
*/
356355
private internalSendTelemetryErrorEvent(
357356
eventName: string,
358357
properties: TelemetryEventProperties | undefined,
359358
measurements: TelemetryEventMeasurements | undefined,
360-
errorProps: string[] | undefined,
361359
sanitize: boolean,
362360
dangerous: boolean
363361
): void {
364362
if ((this.shouldSendErrorTelemetry() || dangerous) && eventName !== "") {
365363

366364
properties = { ...properties, ...this.getCommonProperties() };
367365
if (sanitize) {
368-
// always clean the properties if first party
369-
// do not send any error properties if we shouldn't send error telemetry
370-
// if we have no errorProps, assume all are error props
371-
const cleanProperties = this.cloneAndChange(properties, (key: string, prop: string) => {
372-
373-
if (errorProps === undefined || errorProps.indexOf(key) !== -1) {
374-
return "REDACTED";
375-
}
376-
366+
// Anonymize the file paths
367+
const cleanProperties = this.cloneAndChange(properties, (_: string, prop: string) => {
377368
return this.anonymizeFilePaths(prop, this.firstParty);
378369
});
379370
properties = this.removePropertiesWithPossibleUserInfo(cleanProperties);
@@ -388,10 +379,9 @@ export class BaseTelemetryReporter {
388379
* @param eventName The name of the event
389380
* @param properties The properties to send with the event
390381
* @param measurements The measurements (numeric values) to send with the event
391-
* @param errorProps If not present then we assume all properties belong to the error prop and will be anonymized
392382
*/
393-
public sendTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements, errorProps?: string[]): void {
394-
this.internalSendTelemetryErrorEvent(eventName, properties, measurements, errorProps, true, false);
383+
public sendTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void {
384+
this.internalSendTelemetryErrorEvent(eventName, properties, measurements, true, false);
395385
}
396386

397387
/**
@@ -400,13 +390,12 @@ export class BaseTelemetryReporter {
400390
* @param eventName The name of the event
401391
* @param properties The properties to send with the event
402392
* @param measurements The measurements (numeric values) to send with the event
403-
* @param errorProps If not present then we assume all properties belong to the error prop and will be anonymized
404393
* @param sanitize Whether or not to run the properties and measures through sanitiziation, defaults to true
405394
*/
406-
public sendDangerousTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements, errorProps?: string[], sanitize = true): void {
395+
public sendDangerousTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements, sanitize = true): void {
407396
// Since telemetry is probably off when sending dangerously, we must start the appender
408397
this.telemetryAppender.instantiateAppender();
409-
this.internalSendTelemetryErrorEvent(eventName, properties, measurements, errorProps, sanitize, true);
398+
this.internalSendTelemetryErrorEvent(eventName, properties, measurements, sanitize, true);
410399
}
411400

412401
/**

0 commit comments

Comments
 (0)