Skip to content

Commit c77fda6

Browse files
authored
Merge pull request #110 from microsoft/lramos15/reluctant-shark
Remove error props
2 parents c095592 + 842ffc7 commit c77fda6

File tree

4 files changed

+13
-25
lines changed

4 files changed

+13
-25
lines changed

lib/telemetryReporter.d.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -73,24 +73,23 @@ 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.
77+
* **Note**: The errorProps parameter has been removed since v0.6, if you would like to remove a property please use the replacementOptions parameter in the constructor.
7778
* @param eventName The name of the event
7879
* @param properties The set of properties to add to the event in the form of a string key value pair
7980
* @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
8181
*/
82-
sendTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements, errorProps?: string[]): void;
82+
sendTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void;
8383

8484
/**
8585
* **DANGEROUS** Given an event name, some properties, and measurements sends a telemetry error event without checking telemetry setting
8686
* Do not use unless in a controlled environment i.e. sending telmetry from a CI pipeline or testing during development
8787
* @param eventName The name of the event
8888
* @param properties The properties to send with the event
8989
* @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
9190
* @param sanitize Whether or not to run the properties and measures through sanitiziation, defaults to true
9291
*/
93-
sendDangerousTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements, errorProps?: string[], sanitize?: boolean): void;
92+
sendDangerousTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements, sanitize?: boolean): void;
9493

9594
/**
9695
* Sends an exception which includes the error stack, properties, and measurements

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@vscode/extension-telemetry",
33
"description": "A module for first party microsoft extensions to report consistent telemetry.",
4-
"version": "0.5.2",
4+
"version": "0.6.0",
55
"author": {
66
"name": "Microsoft Corporation"
77
},

src/common/baseTelemetryReporter.ts

+6-17
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)