diff --git a/change/@react-native-windows-telemetry-e8822c8e-55c2-4622-b9ef-48a80761ca6a.json b/change/@react-native-windows-telemetry-e8822c8e-55c2-4622-b9ef-48a80761ca6a.json new file mode 100644 index 00000000000..cd6db4b4024 --- /dev/null +++ b/change/@react-native-windows-telemetry-e8822c8e-55c2-4622-b9ef-48a80761ca6a.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Fix to retrieve deviceId", + "packageName": "@react-native-windows/telemetry", + "email": "hmalothu@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/@react-native-windows/telemetry/src/e2etest/telemetry.test.ts b/packages/@react-native-windows/telemetry/src/e2etest/telemetry.test.ts index ab238b6b14a..388fa6f76ed 100644 --- a/packages/@react-native-windows/telemetry/src/e2etest/telemetry.test.ts +++ b/packages/@react-native-windows/telemetry/src/e2etest/telemetry.test.ts @@ -365,6 +365,11 @@ function verifyTestCommandTelemetryProcessor( // Verify basics const commonProperties = properties!.common; expect(commonProperties.commandName).toBe('test-command'); + // Verify LocalId + const expectedLocalId = TelemetryTest.getCommonProperty('deviceId'); + expect(envelope.ext?.device?.localId).toBeDefined(); + expect(envelope.ext?.device?.localId).toBe(expectedLocalId); + expect(commonProperties.device?.localId).toBe(expectedLocalId); // Only if you know it's set in the event, not in static commonProperties // Verify versions info const versions = properties!.versions; diff --git a/packages/@react-native-windows/telemetry/src/telemetry.ts b/packages/@react-native-windows/telemetry/src/telemetry.ts index 5663a6206eb..d4df35ada91 100644 --- a/packages/@react-native-windows/telemetry/src/telemetry.ts +++ b/packages/@react-native-windows/telemetry/src/telemetry.ts @@ -369,7 +369,7 @@ export class Telemetry { // Populate Part A extensions telemetryItem.ext = {}; telemetryItem.ext.device = { - id: Telemetry.commonProperties.deviceId, + localId: Telemetry.commonProperties.deviceId, deviceClass: Telemetry.commonProperties.deviceClass, }; telemetryItem.ext.os = { @@ -385,6 +385,8 @@ export class Telemetry { numCPUs: Telemetry.commonProperties.numCPUs, totalMemory: Telemetry.commonProperties.totalMemory, diskFreeSpace: Telemetry.commonProperties.deviceDiskFreeSpace, + localId: Telemetry.commonProperties.deviceId, + deviceClass: Telemetry.commonProperties.deviceClass, }, nodePlatform: Telemetry.commonProperties.nodePlatform, nodeArchitecture: Telemetry.commonProperties.nodeArchitecture,