microsoft/vscode-extension-telemetry

Telemetry collecting more properties than I configured

jjaguirre394 opened this issue · 11 comments

Apologies if this is documented somewhere, but I have not been able to find a solution for this. I am collecting a few metrics from our team's vscode extension and sending it to App Insights, however, I noticed that there are a few other fields that are collected automatically that do not align with our PII data requirements.

How can I stop collecting the following items and any other properties that we do not wish to include ? Are these being added by this library on all events?

image

You can use replacementOptons
https://github.com/microsoft/vscode-extension-telemetry/blob/main/dist/telemetryReporter.d.ts#L20-L32

This will use a regex to find the keys you don't care about and then by not providing a replacement string it will just delete the entry.

@lramos15 So the regular expression matches on property name as well? For example, I can create a regular expression that matches on "client_IP", "client_City", etc..., without having a regular expression that matches on the value (Redmond, etc.), is that correct?

@lramos15 So the regular expression matches on property name as well? For example, I can create a regular expression that matches on "client_IP", "client_City", etc..., without having a regular expression that matches on the value (Redmond, etc.), is that correct?

It actually only matches on property name at this point in time, it was added for just this use case :)

@lramos15 So the regular expression matches on property name as well? For example, I can create a regular expression that matches on "client_IP", "client_City", etc..., without having a regular expression that matches on the value (Redmond, etc.), is that correct?

It actually only matches on property name at this point in time, it was added for just this use case :)

@lramos15 it doesn't look like it is working for me. I still see the properties in my app insights logs. This is how I created the telemetry reporter, do you see any issues?

That looks fine to me maybe you can try setting some breakpoints in places such as https://github.com/microsoft/vscode-extension-telemetry/blob/main/src/node/telemetryReporter.ts#L105-L118 to ensure it's getting hit? I'm not too sure, I know other people are using the feature so I believe it does work, but currently on working on transitioning the module to a new telemetry API so unable to investigate at the moment.

@lramos15 I am unsure how to debug as stepping into these methods looks like this. I am new to typescript, is there a mapping file that I can get to map this back to the readable typescript file:

image

@lramos15 it also looks like the unit tests are only testing the case for regex matching in the values and not the property names:

it("Apply replacements", () => {
let replacement: Record<string, any> = {};
TelemetryUtil.applyReplacements(replacement, []);
assert.deepStrictEqual(replacement, {});
replacement = { valueA: "a", valueB: "b", "123": "123" };
TelemetryUtil.applyReplacements(replacement, [{
lookup: /[a]/gi,
replacementString: "c"
}]);
assert.deepStrictEqual(replacement, { valueA: "c", valueB: "b", "123": "123" });
replacement = { valueA: "a", valueB: "b", "123": "123" };
TelemetryUtil.applyReplacements(replacement, [{
lookup: /[a]/gi,
replacementString: undefined
}]);
// Undefined replacement string should remove the key
assert.deepStrictEqual(replacement, { valueB: "b", "123": "123" });

Matching on the values is not as useful for our team as we would have to know all possible values and match for them. Can we re-open this issue?

@lramos15 I still believe maybe some unit tests should be added for the property name case, or at least have documentation on how this feature is designed to be used if it is by design that it does not scan the property names and just filters on the values.

Agreed, but you should no longer need this for your use case now that you're consuming the DevDiv data pipeline

Would you like me to create a separate task/issue for this?

I've created #132