From 43a0b4d0be0683c0772dcbf3dc7d6a070df433e2 Mon Sep 17 00:00:00 2001 From: Marc Paine Date: Tue, 28 Sep 2021 16:38:28 -0700 Subject: [PATCH 1/2] Add OS and Process Architecture --- src/Cli/dotnet/Telemetry/TelemetryCommonProperties.cs | 4 ++++ src/Tests/dotnet.Tests/TelemetryCommonPropertiesTests.cs | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/Cli/dotnet/Telemetry/TelemetryCommonProperties.cs b/src/Cli/dotnet/Telemetry/TelemetryCommonProperties.cs index 0951307041ed..b145592fa4bb 100644 --- a/src/Cli/dotnet/Telemetry/TelemetryCommonProperties.cs +++ b/src/Cli/dotnet/Telemetry/TelemetryCommonProperties.cs @@ -34,6 +34,8 @@ public TelemetryCommonProperties( private IUserLevelCacheWriter _userLevelCacheWriter; private const string OSVersion = "OS Version"; private const string OSPlatform = "OS Platform"; + private const string OSArchitecture = "OS Architecture"; + private const string ProcessArchitecture = "Process Architecture"; private const string OutputRedirected = "Output Redirected"; private const string RuntimeId = "Runtime Id"; private const string ProductVersion = "Product Version"; @@ -60,6 +62,8 @@ public Dictionary GetTelemetryCommonProperties() { {OSVersion, RuntimeEnvironment.OperatingSystemVersion}, {OSPlatform, RuntimeEnvironment.OperatingSystemPlatform.ToString()}, + {OSArchitecture, RuntimeInformation.OSArchitecture.ToString()}, + {ProcessArchitecture, RuntimeInformation.ProcessArchitecture.ToString()}, {OutputRedirected, Console.IsOutputRedirected.ToString()}, {RuntimeId, RuntimeInformation.RuntimeIdentifier}, {ProductVersion, Product.Version}, diff --git a/src/Tests/dotnet.Tests/TelemetryCommonPropertiesTests.cs b/src/Tests/dotnet.Tests/TelemetryCommonPropertiesTests.cs index 4ccdf3e240fd..f281525ff4de 100644 --- a/src/Tests/dotnet.Tests/TelemetryCommonPropertiesTests.cs +++ b/src/Tests/dotnet.Tests/TelemetryCommonPropertiesTests.cs @@ -78,6 +78,14 @@ public void TelemetryCommonPropertiesShouldContainKernelVersion() unitUnderTest.GetTelemetryCommonProperties()["Kernel Version"].Should().Be(RuntimeInformation.OSDescription); } + [Fact] + public void TelemetryCommonPropertiesShouldContainArchitectureInformation() + { + var unitUnderTest = new TelemetryCommonProperties(getMACAddress: () => null, userLevelCacheWriter: new NothingCache()); + unitUnderTest.GetTelemetryCommonProperties()["OS Architecture"].Should().Be(RuntimeInformation.OSArchitecture.ToString()); + unitUnderTest.GetTelemetryCommonProperties()["Process Architecture"].Should().Be(RuntimeInformation.ProcessArchitecture.ToString()); + } + [WindowsOnlyFact] public void TelemetryCommonPropertiesShouldContainWindowsInstallType() { From 5e7f224ca1f18949602d54b0778df242417deb59 Mon Sep 17 00:00:00 2001 From: Marc Paine Date: Wed, 6 Oct 2021 16:59:57 -0700 Subject: [PATCH 2/2] Remove the Process architecture as we believe we can use the RuntimeID for this instead. --- src/Cli/dotnet/Telemetry/TelemetryCommonProperties.cs | 2 -- src/Tests/dotnet.Tests/TelemetryCommonPropertiesTests.cs | 1 - 2 files changed, 3 deletions(-) diff --git a/src/Cli/dotnet/Telemetry/TelemetryCommonProperties.cs b/src/Cli/dotnet/Telemetry/TelemetryCommonProperties.cs index b145592fa4bb..6ba2c59e3eac 100644 --- a/src/Cli/dotnet/Telemetry/TelemetryCommonProperties.cs +++ b/src/Cli/dotnet/Telemetry/TelemetryCommonProperties.cs @@ -35,7 +35,6 @@ public TelemetryCommonProperties( private const string OSVersion = "OS Version"; private const string OSPlatform = "OS Platform"; private const string OSArchitecture = "OS Architecture"; - private const string ProcessArchitecture = "Process Architecture"; private const string OutputRedirected = "Output Redirected"; private const string RuntimeId = "Runtime Id"; private const string ProductVersion = "Product Version"; @@ -63,7 +62,6 @@ public Dictionary GetTelemetryCommonProperties() {OSVersion, RuntimeEnvironment.OperatingSystemVersion}, {OSPlatform, RuntimeEnvironment.OperatingSystemPlatform.ToString()}, {OSArchitecture, RuntimeInformation.OSArchitecture.ToString()}, - {ProcessArchitecture, RuntimeInformation.ProcessArchitecture.ToString()}, {OutputRedirected, Console.IsOutputRedirected.ToString()}, {RuntimeId, RuntimeInformation.RuntimeIdentifier}, {ProductVersion, Product.Version}, diff --git a/src/Tests/dotnet.Tests/TelemetryCommonPropertiesTests.cs b/src/Tests/dotnet.Tests/TelemetryCommonPropertiesTests.cs index f281525ff4de..24b6789ea290 100644 --- a/src/Tests/dotnet.Tests/TelemetryCommonPropertiesTests.cs +++ b/src/Tests/dotnet.Tests/TelemetryCommonPropertiesTests.cs @@ -83,7 +83,6 @@ public void TelemetryCommonPropertiesShouldContainArchitectureInformation() { var unitUnderTest = new TelemetryCommonProperties(getMACAddress: () => null, userLevelCacheWriter: new NothingCache()); unitUnderTest.GetTelemetryCommonProperties()["OS Architecture"].Should().Be(RuntimeInformation.OSArchitecture.ToString()); - unitUnderTest.GetTelemetryCommonProperties()["Process Architecture"].Should().Be(RuntimeInformation.ProcessArchitecture.ToString()); } [WindowsOnlyFact]