Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .pipelines/azure-pipelines-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pool:
vmImage: ubuntu-latest

variables:
VcVersion : 1.9.4
VcVersion : 1.9.5
ROOT: $(Build.SourcesDirectory)
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
ENABLE_PRS_DELAYSIGN: 1
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pool:
vmImage: windows-latest

variables:
VcVersion : 1.9.4
VcVersion : 1.9.5
ROOT: $(Build.SourcesDirectory)
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
ENABLE_PRS_DELAYSIGN: 1
Expand Down
3 changes: 0 additions & 3 deletions src/VirtualClient/Module.props
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@

<!-- Microsoft.Extensions.Http.Polly -->
<Microsoft_Extensions_Http_Polly_PackageVersion>6.0.9</Microsoft_Extensions_Http_Polly_PackageVersion>

<!-- Microsoft.Management.Infrastructure -->
<Microsoft_Management_Infrastructure_PackageVersion>2.0.0</Microsoft_Management_Infrastructure_PackageVersion>

<!-- Microsoft.Windows.Compatibility -->
<Microsoft_Windows_Compatibility_PackageVersion>6.0.0</Microsoft_Windows_Compatibility_PackageVersion>
Expand Down
37 changes: 1 addition & 36 deletions src/VirtualClient/VirtualClient.Core/SystemManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ namespace VirtualClient
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Management.Infrastructure;
using Microsoft.Management.Infrastructure.Options;
using Microsoft.Win32;
using Polly;
using VirtualClient.Common;
Expand Down Expand Up @@ -319,40 +317,7 @@ private async Task<MemoryInfo> GetMemoryInfoOnUnixAsync()

private MemoryInfo GetMemoryInfoOnWindows()
{
List<MemoryChipInfo> chips = null;
CimSession session = CimSession.Create("localhost", new DComSessionOptions());
IEnumerable<CimInstance> hardwareDefinitions = session.QueryInstances(@"Root\CIMV2", "WQL", "SELECT * FROM CIM_PhysicalMemory");

if (hardwareDefinitions?.Any() == true)
{
chips = new List<MemoryChipInfo>();
int chipIndex = 0;
foreach (CimInstance instance in hardwareDefinitions)
{
object capacity = instance.CimInstanceProperties["Capacity"]?.Value;
object speed = instance.CimInstanceProperties["Speed"]?.Value;

// Physical blades will produce full specs for the hardware memory modules. This means
// that we will have the speed as well as valid manufacturer information. VMs will not have
// this information and there is not much useful there to capture.
chipIndex++;
if (long.TryParse(capacity?.ToString(), out long memoryCapacity) && long.TryParse(speed?.ToString(), out long memorySpeed))
{
object manufacturer = instance.CimInstanceProperties["Manufacturer"]?.Value;
object partNumber = instance.CimInstanceProperties["PartNumber"]?.Value;

chips.Add(new MemoryChipInfo(
$"Memory_{chipIndex}",
$"{manufacturer} Memory Chip",
memoryCapacity,
memorySpeed,
manufacturer?.ToString().Trim(),
partNumber?.ToString().Trim()));
}
}
}

return new MemoryInfo(this.GetTotalSystemMemoryKiloBytes(), chips);
return new MemoryInfo(this.GetTotalSystemMemoryKiloBytes());
}

private async Task<NetworkInfo> GetNetworkInfoOnUnixAsync()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<!-- Global package dependency versions are defined in the Module.props for the solution. -->
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(Microsoft_AspNetCore_Hosting_PackageVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="$(Microsoft_CodeAnalysis_CSharp_Scripting_PackageVersion)" />
<PackageReference Include="Microsoft.Management.Infrastructure" Version="$(Microsoft_Management_Infrastructure_PackageVersion)" />
<PackageReference Include="Microsoft.Win32.Registry" Version="$(Microsoft_Win32_Registry_PackageVersion)" />
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="$(System_Diagnostics_PerformanceCounter_PackageVersion)" />
</ItemGroup>
Expand Down

This file was deleted.

14 changes: 13 additions & 1 deletion src/VirtualClient/VirtualClient.Main/RunProfileCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace VirtualClient
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Polly;
using Serilog.Core;
using VirtualClient.Common;
using VirtualClient.Common.Contracts;
using VirtualClient.Common.Extensions;
Expand Down Expand Up @@ -138,6 +139,8 @@ await this.InitializePackagesAsync(packageManager, cancellationToken)
await this.InstallExtensionsAsync(packageManager, cancellationToken)
.ConfigureAwait(false);

this.SetHostMetadata(profileNames, dependencies);

// Ensure all Virtual Client types are loaded from .dlls in the execution directory.
ComponentTypeCache.Instance.LoadComponentTypes(Path.GetDirectoryName(Assembly.GetAssembly(typeof(Program)).Location));

Expand Down Expand Up @@ -618,8 +621,17 @@ protected void SetGlobalTelemetryProperties(IEnumerable<string> profiles, IServi
// VC on the command line.
metadata["experimentId"] = this.ExperimentId.ToLowerInvariant();
metadata["agentId"] = this.AgentId;

MetadataContract.Persist(metadata, MetadataContractCategory.Default);
}

/// <summary>
/// Initializes the global/persistent telemetry properties that will be included
/// with all telemetry emitted from the Virtual Client.
/// </summary>
protected void SetHostMetadata(IEnumerable<string> profiles, IServiceCollection dependencies)
{
ILogger logger = dependencies.GetService<ILogger>();
ISystemManagement systemManagement = dependencies.GetService<ISystemManagement>();

IDictionary<string, object> hostMetadata = systemManagement.GetHostMetadataAsync(logger)
.GetAwaiter().GetResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ private class TestRunProfileCommand : RunProfileCommand
{
base.SetGlobalTelemetryProperties(profiles, dependencies);
}

public new void SetHostMetadata(IEnumerable<string> profiles, IServiceCollection dependencies)
{
base.SetHostMetadata(profiles, dependencies);
}
}

private static Tuple<string, string> GetAccessTokenPair()
Expand Down