Skip to content

Commit 8680873

Browse files
authored
Merge branch 'microsoft:main' into recording-redis-version-clean
2 parents 2b93adf + 7d65516 commit 8680873

File tree

66 files changed

+2934
-596
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2934
-596
lines changed

.github/workflows/pull-request.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
dotnet-version: 9.0.x
3535

3636
- name: Initialize CodeQL
37+
if: false # this is causing PR to fail on Windows with single slashes on Windows, temporarily disabling since we have it in Linux PR
3738
uses: github/codeql-action/init@v2
3839
with:
3940
languages: ${{ matrix.language }}
@@ -51,6 +52,7 @@ jobs:
5152
run: ./build-test.cmd
5253

5354
- name: Perform CodeQL Analysis
55+
if: false # this is causing PR to fail on Windows with single slashes on Windows, temporarily disabling since we have it in Linux PR
5456
uses: github/codeql-action/analyze@v2
5557
with:
5658
category: "/language:${{matrix.language}}"

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.16
1+
2.0.27

src/VirtualClient/Module.props

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@
3131

3232
<!-- Azure.Messaging.EventHubs -->
3333
<Azure_Messaging_EventHubs_PackageVersion>5.11.5</Azure_Messaging_EventHubs_PackageVersion>
34+
35+
<!-- Azure.Security.KeyVault.Certificates -->
36+
<Azure_Security_KeyVault_Certificates_PackageVersion>4.7.0</Azure_Security_KeyVault_Certificates_PackageVersion>
37+
38+
<!-- Azure.Security.KeyVault.Keys -->
39+
<Azure_Security_KeyVault_Keys_PackageVersion>4.7.0</Azure_Security_KeyVault_Keys_PackageVersion>
40+
41+
<!-- Azure.Security.KeyVault.Secrets -->
42+
<Azure_Security_KeyVault_Secrets_PackageVersion>4.7.0</Azure_Security_KeyVault_Secrets_PackageVersion>
3443

3544
<!-- Azure.Storage.Blobs -->
3645
<Azure_Storage_Blobs_PackageVersion>12.18.0</Azure_Storage_Blobs_PackageVersion>
@@ -117,7 +126,7 @@
117126
<System_Diagnostics_PerformanceCounter_PackageVersion>9.0.3</System_Diagnostics_PerformanceCounter_PackageVersion>
118127

119128
<!-- System.IO.Abstractions -->
120-
<System_IO_Abstractions_PackageVersion>21.0.29</System_IO_Abstractions_PackageVersion>
129+
<System_IO_Abstractions_PackageVersion>22.0.14</System_IO_Abstractions_PackageVersion>
121130

122131
<!-- System.IO.FileSystem.AccessControl -->
123132
<System_IO_FileSystem_AccessControl_PackageVersion>5.0.0</System_IO_FileSystem_AccessControl_PackageVersion>
@@ -145,7 +154,7 @@
145154

146155
<!-- System.ServiceProcess.ServiceController -->
147156
<System_ServiceProcess_ServiceController_PackageVersion>9.0.3</System_ServiceProcess_ServiceController_PackageVersion>
148-
157+
149158
<!-- YamlDotNet -->
150159
<YamlDotNet_PackageVersion>15.1.1</YamlDotNet_PackageVersion>
151160

src/VirtualClient/VirtualClient.Actions.UnitTests/DiskSpd/DiskSpdMetricsParserTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public void DiskSpdParserVerifyForCoreCountGreaterThan64WhichAddsProcessorGroupi
206206
var parser = new DiskSpdMetricsParser(results, "diskspd.exe -b8K -r8K -t32 -o16 -w100 -d900 -Suw -W30 -D -L -Rtext D:\\diskspd-test.dat");
207207

208208
IList<Metric> metrics = parser.Parse();
209-
metrics.LogConsole("test");
209+
metrics.LogConsole("test", "testtool");
210210

211211
// cpu metrics
212212
MetricAssert.Exists(metrics, "cpu usage 0", 92.79, "percentage");

src/VirtualClient/VirtualClient.Actions.UnitTests/Memtier/MemtierBenchmarkClientExecutorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public async Task MemtierBenchmarkClientExecutorEmitsTheExpectedMetricsRawMetric
300300

301301
await executor.ExecuteAsync(CancellationToken.None);
302302

303-
IEnumerable<Tuple<LogLevel, EventId, object, Exception>> metricsEmitted = this.mockFixture.Logger.MessagesLogged(new Regex("ScenarioResult"));
303+
IEnumerable<Tuple<LogLevel, EventId, object, Exception>> metricsEmitted = this.mockFixture.Logger.MessagesLogged(new Regex("(ScenarioResult)|(SucceededOrFailed)"));
304304
Assert.AreEqual(30, metricsEmitted.Count());
305305

306306
IEnumerable<string> expectedMetrics = new List<string>
@@ -362,7 +362,7 @@ public async Task MemtierBenchmarkClientExecutorEmitsTheExpectedMetricsAggregate
362362

363363
await executor.ExecuteAsync(CancellationToken.None);
364364

365-
IEnumerable<Tuple<LogLevel, EventId, object, Exception>> metricsEmitted = this.mockFixture.Logger.MessagesLogged(new Regex("ScenarioResult"));
365+
IEnumerable<Tuple<LogLevel, EventId, object, Exception>> metricsEmitted = this.mockFixture.Logger.MessagesLogged(new Regex("(ScenarioResult)|(SucceededOrFailed)"));
366366
Assert.AreEqual(141, metricsEmitted.Count());
367367

368368
IEnumerable<string> expectedMetrics = new List<string>

src/VirtualClient/VirtualClient.Actions.UnitTests/OpenSSL/OpenSslExecutorTests.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class OpenSslExecutorTests
2323
{
2424
private DependencyFixture fixture;
2525
private DependencyPath mockPackage;
26+
private string mockOpensslVersion = "OpenSSL 3.5.0 8 Apr 2025 (Library: OpenSSL 3.5.0 8 Apr 2025)\n";
2627

2728
[Test]
2829
[TestCase(PlatformID.Unix, Architecture.X64, "linux-x64/bin/openssl")]
@@ -287,6 +288,24 @@ await executor.ExecuteAsync(CancellationToken.None)
287288
}
288289
}
289290

291+
[Test]
292+
public async Task OpenSslExecutorExecutesGetOpensslVersionAsync()
293+
{
294+
this.SetupDefaultBehaviors();
295+
this.SetupOpensslVersionBehavior();
296+
297+
using (TestOpenSslExecutor executor = new TestOpenSslExecutor(this.fixture))
298+
{
299+
300+
await executor.ExecuteAsync(CancellationToken.None)
301+
.ConfigureAwait(false);
302+
303+
var messages = this.fixture.Logger.MessagesLogged($"{nameof(OpenSslExecutor)}.GetOpenSslVersionAsync");
304+
Assert.IsNotEmpty(messages);
305+
Assert.IsTrue(messages.All(msg => (msg.Item3 as EventContext).Properties["opensslVersion"].ToString() == "OpenSSL 3.5.0 8 Apr 2025 (Library: OpenSSL 3.5.0 8 Apr 2025)"));
306+
}
307+
}
308+
290309
private void SetupDefaultBehaviors(PlatformID platform = PlatformID.Unix, Architecture architecture = Architecture.X64)
291310
{
292311
// Setup the default behaviors given all expected dependencies are in place such that the
@@ -329,8 +348,20 @@ private void SetupDefaultBehaviors(PlatformID platform = PlatformID.Unix, Archit
329348
process.StandardOutput.Append(TestResources.Results_OpenSSL_speed);
330349
}
331350
};
351+
332352
}
333353

354+
private void SetupOpensslVersionBehavior()
355+
{
356+
this.fixture.ProcessManager.OnProcessCreated = (process) =>
357+
{
358+
// mock openssl version command result
359+
if (process.IsMatch("openssl(.exe)* version"))
360+
{
361+
process.StandardOutput.Append(this.mockOpensslVersion);
362+
}
363+
};
364+
}
334365
private class TestOpenSslExecutor : OpenSslExecutor
335366
{
336367
public TestOpenSslExecutor(DependencyFixture mockFixture)

src/VirtualClient/VirtualClient.Actions/DiskSpd/DiskSpdExecutor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ private void CaptureMetrics(DiskWorkloadProcess workload, EventContext telemetry
355355
metrics = metrics.FilterBy(this.MetricFilters).ToList();
356356
}
357357

358-
metrics.LogConsole(this.MetricScenario ?? this.Scenario);
358+
metrics.LogConsole(this.MetricScenario ?? this.Scenario, "DiskSpd");
359359

360360
this.Logger.LogMetrics(
361361
"DiskSpd",

src/VirtualClient/VirtualClient.Actions/OpenSSL/OpenSslExecutor.cs

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace VirtualClient.Actions
1818
using VirtualClient.Common.Telemetry;
1919
using VirtualClient.Contracts;
2020
using VirtualClient.Contracts.Metadata;
21+
using YamlDotNet.Serialization;
2122

2223
/// <summary>
2324
/// Executes the OpenSSL workload.
@@ -90,17 +91,50 @@ await this.InitializeWorkloadToolsetsAsync(cancellationToken)
9091
.ConfigureAwait(false);
9192
}
9293

93-
private void CaptureMetrics(IProcessProxy workloadProcess, string commandArguments, EventContext telemetryContext)
94+
/// <summary>
95+
/// Gets openssl version by running openssl version command.
96+
/// </summary>
97+
private async Task GetOpenSslVersionAsync(string toolCommand, CancellationToken cancellationToken)
9498
{
95-
if (workloadProcess.ExitCode == 0)
99+
// The OpenSSL version is not available in the workload output. We need to run a separate command to get the version.
100+
// The command 'openssl version' will return the version of OpenSSL installed on the system.
101+
string opensslVersion = "Unknown";
102+
if (!cancellationToken.IsCancellationRequested)
96103
{
97-
try
104+
this.Logger.LogTraceMessage($"Executing process 'openssl version' at directory '{this.ExecutablePath}'.");
105+
using (IProcessProxy process = this.systemManagement.ProcessManager.CreateProcess(this.ExecutablePath, "version"))
98106
{
107+
this.SetEnvironmentVariables(process);
108+
await process.StartAndWaitAsync(cancellationToken).ConfigureAwait(false);
109+
process.ThrowIfWorkloadFailed();
110+
111+
opensslVersion = process.StandardOutput?.ToString().Trim() ?? "Unknown";
112+
if (string.IsNullOrWhiteSpace(opensslVersion))
113+
{
114+
opensslVersion = "Unknown";
115+
}
116+
117+
this.MetadataContract.Add("OpenSSLVersion", opensslVersion, MetadataContractCategory.Dependencies);
118+
this.Logger.LogMessage($"{nameof(OpenSslExecutor)}.GetOpenSslVersionAsync", LogLevel.Information, EventContext.Persisted().AddContext("opensslVersion", opensslVersion));
119+
99120
this.MetadataContract.AddForScenario(
100121
"OpenSSL Speed",
101-
workloadProcess.FullCommand(),
102-
toolVersion: null);
122+
toolCommand,
123+
toolVersion: opensslVersion);
124+
}
125+
}
126+
127+
}
103128

129+
private async Task CaptureMetricsAsync(IProcessProxy workloadProcess, string commandArguments, EventContext telemetryContext, CancellationToken cancellationToken)
130+
{
131+
if (workloadProcess.ExitCode == 0)
132+
{
133+
try
134+
{
135+
// Retrieve OpenSSL version
136+
await this.GetOpenSslVersionAsync(workloadProcess.FullCommand(), cancellationToken);
137+
104138
this.MetadataContract.Apply(telemetryContext);
105139

106140
OpenSslMetricsParser resultsParser = new OpenSslMetricsParser(workloadProcess.StandardOutput.ToString(), commandArguments);
@@ -116,6 +150,8 @@ private void CaptureMetrics(IProcessProxy workloadProcess, string commandArgumen
116150
commandArguments,
117151
this.Tags,
118152
telemetryContext);
153+
154+
metrics.LogConsole(this.Scenario, "OpenSSL");
119155
}
120156
catch (SchemaException exc)
121157
{
@@ -133,7 +169,7 @@ private Task ExecuteWorkloadAsync(EventContext telemetryContext, CancellationTok
133169

134170
EventContext relatedContext = telemetryContext.Clone()
135171
.AddContext("executable", this.ExecutablePath)
136-
.AddContext("commandArguments", commandArguments);
172+
.AddContext("commandArguments", commandArguments);
137173

138174
return this.Logger.LogMessageAsync($"{nameof(OpenSslExecutor)}.ExecuteWorkload", relatedContext, async () =>
139175
{
@@ -153,7 +189,7 @@ private Task ExecuteWorkloadAsync(EventContext telemetryContext, CancellationTok
153189
await this.LogProcessDetailsAsync(process, telemetryContext, "OpenSSL", logToFile: true);
154190

155191
process.ThrowIfWorkloadFailed();
156-
this.CaptureMetrics(process, commandArguments, telemetryContext);
192+
await this.CaptureMetricsAsync(process, commandArguments, telemetryContext, cancellationToken);
157193
}
158194
}
159195
finally

src/VirtualClient/VirtualClient.Actions/SPECcpu/SpecCpuExecutor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ private async Task CaptureMetricsAsync(IProcessProxy process, string commandArgu
337337

338338
SpecCpuMetricsParser parser = new SpecCpuMetricsParser(results);
339339
IList<Metric> metrics = parser.Parse();
340-
metrics.LogConsole(this.Scenario);
340+
metrics.LogConsole(this.Scenario, "SPECcpu");
341341

342342
this.Logger.LogMetrics(
343343
toolName: "SPECcpu",

src/VirtualClient/VirtualClient.Common/Extensions/StringExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace VirtualClient.Common.Extensions
66
using System;
77
using System.Collections;
88
using System.Diagnostics.CodeAnalysis;
9+
using System.Linq;
910
using System.Runtime.InteropServices;
1011
using System.Security;
1112
using System.Text.RegularExpressions;

0 commit comments

Comments
 (0)