Skip to content

Commit

Permalink
Add OS and Process Architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
marcpopMSFT committed Sep 29, 2021
1 parent d0b9b27 commit 43a0b4d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Cli/dotnet/Telemetry/TelemetryCommonProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -60,6 +62,8 @@ public Dictionary<string, string> 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},
Expand Down
8 changes: 8 additions & 0 deletions src/Tests/dotnet.Tests/TelemetryCommonPropertiesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down

0 comments on commit 43a0b4d

Please sign in to comment.