Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OS and Process Architecture #21517

Merged
merged 2 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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