Skip to content

Commit 5a5903a

Browse files
authored
Add telemetry for machineId changes and remoteName (#6419)
1 parent fc7cdac commit 5a5903a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Extension/src/LanguageServer/extension.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,31 @@ function onActivationEvent(): void {
263263
activatedPreviously.Value = true;
264264
}
265265

266+
function sendActivationTelemetry(): void {
267+
const activateEvent: { [key: string]: string } = {};
268+
// Don't log telemetry for machineId if it's a special value used by the dev host: someValue.machineid
269+
if (vscode.env.machineId !== "someValue.machineId") {
270+
const machineIdPersistentState: PersistentState<string | undefined> = new PersistentState<string | undefined>("CPP.machineId", undefined);
271+
if (!machineIdPersistentState.Value) {
272+
activateEvent["newMachineId"] = vscode.env.machineId;
273+
} else if (machineIdPersistentState.Value !== vscode.env.machineId) {
274+
activateEvent["newMachineId"] = vscode.env.machineId;
275+
activateEvent["oldMachineId"] = machineIdPersistentState.Value;
276+
}
277+
machineIdPersistentState.Value = vscode.env.machineId;
278+
}
279+
if (vscode.env.remoteName) {
280+
activateEvent["remoteName"] = vscode.env.remoteName;
281+
}
282+
telemetry.logLanguageServerEvent("Activate", activateEvent);
283+
}
284+
266285
function realActivation(): void {
267286
if (new CppSettings().intelliSenseEngine === "Disabled") {
268287
throw new Error(intelliSenseDisabledError);
269288
} else {
270289
console.log("activating extension");
290+
sendActivationTelemetry();
271291
const checkForConflictingExtensions: PersistentState<boolean> = new PersistentState<boolean>("CPP." + util.packageJson.version + ".checkForConflictingExtensions", true);
272292
if (checkForConflictingExtensions.Value) {
273293
checkForConflictingExtensions.Value = false;

0 commit comments

Comments
 (0)