MCPcopy Index your code
hub / github.com/microsoft/vscode-cpptools / logMachineIdMappings

Function logMachineIdMappings

Extension/src/id.ts:13–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11 * Hash the MAC addresses on the machine (Windows-only) and log telemetry.
12 */
13export async function logMachineIdMappings(): Promise<void> {
14 if (!isWindows) {
15 return;
16 }
17
18 const macAddresses = await getMacAddresses();
19
20 // The first MAC address is the one Visual Studio uses
21 const primary = await getMachineId(macAddresses.shift());
22 if (primary) {
23 logLanguageServerEvent('machineIdMap', { primary });
24 }
25
26 // VS Code uses os.networkInterfaces() which has different sorting and availability,
27 // but all MAC addresses are returned by getmac.exe. The ID VS Code uses may change
28 // based on changes to the network configuration. Log the extras so we can assess
29 // how frequently this impacts the machine id.
30 for (const macAddress of macAddresses) {
31 const additional = await getMachineId(macAddress);
32 if (additional) {
33 logLanguageServerEvent('machineIdMap', { additional });
34 }
35 }
36}
37
38/**
39 * Parse the output of getmac.exe to get the list of MAC addresses for the PC.

Callers 1

sendTelemetryFunction · 0.90

Calls 3

logLanguageServerEventFunction · 0.90
getMacAddressesFunction · 0.85
getMachineIdFunction · 0.85

Tested by

no test coverage detected