From 2769c2e37fabcf6e9003657d1ef6d7ebdd97cc34 Mon Sep 17 00:00:00 2001 From: Rakeshwar Reddy Kambaiahgari Date: Tue, 26 May 2026 17:04:38 -0700 Subject: [PATCH 1/3] remove WMI auto-switch --- .../profiles/MONITORS-COUNTERS.json | 4 ++-- .../profiles/MONITORS-DEFAULT.json | 4 ++-- .../WindowsPerformanceCounterMonitor.cs | 20 +++++++------------ .../WindowsWmiPerformanceCounterMonitor.cs | 11 +++++----- 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-COUNTERS.json b/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-COUNTERS.json index 7ca75e55c7..01c1377d17 100644 --- a/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-COUNTERS.json +++ b/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-COUNTERS.json @@ -55,8 +55,8 @@ "Counters10": "Memory=Faults/sec", "Counters11": "Memory=(Page Reads/sec|Page Writes/sec|Pages/sec|Pages Input/sec|Pages Output/sec)", "Counters12": "PhysicalDisk=\\(_Total\\)", - "Counters13": "Processor=\\(_Total\\)", - "Counters14": "Processor=\\([0-9,]+\\)\\\\% (C[0-9]+|Idle|Interrupt|Privileged|Processor|User) Time", + "Counters13": "Processor Information=\\(_Total\\)", + "Counters14": "Processor Information=\\([0-9,]+\\)\\\\% (C[0-9]+|Idle|Interrupt|Privileged|Processor|User) Time", "Counters15": "System=.", "Comments": "The counters defined are formatted as {category}={counter_match_expression}. The match expression is a regular expression to allow for handling variability of counters available on different systems. JSON content has eccentricities. Use 4-backslashes to represent a single backslash and 2-backslashes to represent a regular expression character escape." } diff --git a/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-DEFAULT.json b/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-DEFAULT.json index e9fd7c9521..c6e10f0bb0 100644 --- a/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-DEFAULT.json +++ b/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-DEFAULT.json @@ -154,8 +154,8 @@ "Counters10": "Memory=Faults/sec", "Counters11": "Memory=(Page Reads/sec|Page Writes/sec|Pages/sec|Pages Input/sec|Pages Output/sec)", "Counters12": "PhysicalDisk=\\(_Total\\)", - "Counters13": "Processor=\\(_Total\\)", - "Counters14": "Processor=\\([0-9,]+\\)\\\\% (C[0-9]+|Idle|Interrupt|Privileged|Processor|User) Time", + "Counters13": "Processor Information=\\(_Total\\)", + "Counters14": "Processor Information=\\([0-9,]+\\)\\\\% (C[0-9]+|Idle|Interrupt|Privileged|Processor|User) Time", "Counters15": "System=.", "Comments": "The counters defined are formatted as {category}={counter_match_expression}. The match expression is a regular expression to allow for handling variability of counters available on different systems. JSON content has eccentricities. Use 4-backslashes to represent a single backslash and 2-backslashes to represent a regular expression character escape." } diff --git a/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsPerformanceCounterMonitor.cs b/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsPerformanceCounterMonitor.cs index af9e1b54b4..c6cd631b83 100644 --- a/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsPerformanceCounterMonitor.cs +++ b/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsPerformanceCounterMonitor.cs @@ -73,9 +73,10 @@ public TimeSpan CounterDiscoveryInterval /// /// Defines the counter provider to use. Supported values: "Default" and "WMI". - /// When set to "Default", the monitor auto-selects WMI on systems with more than - /// 64 logical processors where the legacy .NET PerformanceCounter API fails. - /// When set to "WMI", the WMI provider is always used regardless of LP count. + /// When set to "Default" (or any value other than "WMI"), the .NET PerformanceCounter + /// API is used. When set to "WMI", the WMI provider is used. The provider is selected + /// strictly from this parameter; the monitor does not infer a provider from system + /// characteristics such as logical processor count. /// public string CounterProvider { @@ -91,21 +92,14 @@ public string CounterProvider protected virtual string CounterProviderName => this.UseWmiProvider ? "WMI" : ".NET SDK"; /// - /// Returns true when the WMI provider should be used, based on the CounterProvider - /// parameter and the system's logical processor count. + /// Returns true only when the parameter is explicitly + /// set to "WMI". No implicit/automatic selection is performed. /// protected bool UseWmiProvider { get { - if (string.Equals(this.CounterProvider, "WMI", StringComparison.OrdinalIgnoreCase)) - { - return true; - } - - // Auto-select WMI when the system has >64 logical processors. - // The legacy .NET PerformanceCounter API fails on these systems. - return Environment.ProcessorCount > 64; + return string.Equals(this.CounterProvider, "WMI", StringComparison.OrdinalIgnoreCase); } } diff --git a/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsWmiPerformanceCounterMonitor.cs b/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsWmiPerformanceCounterMonitor.cs index 3892edd8e6..786fde056f 100644 --- a/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsWmiPerformanceCounterMonitor.cs +++ b/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsWmiPerformanceCounterMonitor.cs @@ -14,14 +14,13 @@ namespace VirtualClient.Monitors /// /// Monitor captures performance counters from Windows systems using WMI - /// (CimSession querying Win32_PerfFormattedData_* classes). Required on - /// bare-metal systems with more than 64 logical processors where the legacy - /// .NET PerformanceCounter API fails. + /// (CimSession querying Win32_PerfFormattedData_* classes). Opt-in alternative + /// to the default .NET PerformanceCounter API path. /// /// /// This subclass always uses the WMI provider regardless of the CounterProvider - /// parameter or logical processor count. It can be referenced directly in profiles - /// as an alternative to setting CounterProvider=WMI on the base class. + /// parameter. It can be referenced directly in profiles as an alternative to + /// setting CounterProvider=WMI on the base class. /// public class WindowsWmiPerformanceCounterMonitor : WindowsPerformanceCounterMonitor { @@ -37,7 +36,7 @@ public WindowsWmiPerformanceCounterMonitor(IServiceCollection dependencies, IDic protected override string CounterProviderName => "WMI"; /// - /// Always uses WMI for counter discovery, bypassing the auto-detection logic. + /// Always uses WMI for counter discovery. /// protected override void LoadCounters(EventContext telemetryContext, CancellationToken cancellationToken) { From c95fa8a87b6a9abea7a5995b85e97a0687d88e6e Mon Sep 17 00:00:00 2001 From: Rakeshwar Reddy Kambaiahgari Date: Tue, 26 May 2026 17:04:38 -0700 Subject: [PATCH 2/3] remove WMI auto-switch --- .../profiles/MONITORS-COUNTERS.json | 4 ++-- .../profiles/MONITORS-DEFAULT.json | 4 ++-- .../WindowsPerformanceCounterMonitor.cs | 20 +++++++------------ .../WindowsWmiPerformanceCounterMonitor.cs | 11 +++++----- 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-COUNTERS.json b/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-COUNTERS.json index 7ca75e55c7..01c1377d17 100644 --- a/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-COUNTERS.json +++ b/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-COUNTERS.json @@ -55,8 +55,8 @@ "Counters10": "Memory=Faults/sec", "Counters11": "Memory=(Page Reads/sec|Page Writes/sec|Pages/sec|Pages Input/sec|Pages Output/sec)", "Counters12": "PhysicalDisk=\\(_Total\\)", - "Counters13": "Processor=\\(_Total\\)", - "Counters14": "Processor=\\([0-9,]+\\)\\\\% (C[0-9]+|Idle|Interrupt|Privileged|Processor|User) Time", + "Counters13": "Processor Information=\\(_Total\\)", + "Counters14": "Processor Information=\\([0-9,]+\\)\\\\% (C[0-9]+|Idle|Interrupt|Privileged|Processor|User) Time", "Counters15": "System=.", "Comments": "The counters defined are formatted as {category}={counter_match_expression}. The match expression is a regular expression to allow for handling variability of counters available on different systems. JSON content has eccentricities. Use 4-backslashes to represent a single backslash and 2-backslashes to represent a regular expression character escape." } diff --git a/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-DEFAULT.json b/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-DEFAULT.json index e9fd7c9521..c6e10f0bb0 100644 --- a/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-DEFAULT.json +++ b/src/VirtualClient/VirtualClient.Main/profiles/MONITORS-DEFAULT.json @@ -154,8 +154,8 @@ "Counters10": "Memory=Faults/sec", "Counters11": "Memory=(Page Reads/sec|Page Writes/sec|Pages/sec|Pages Input/sec|Pages Output/sec)", "Counters12": "PhysicalDisk=\\(_Total\\)", - "Counters13": "Processor=\\(_Total\\)", - "Counters14": "Processor=\\([0-9,]+\\)\\\\% (C[0-9]+|Idle|Interrupt|Privileged|Processor|User) Time", + "Counters13": "Processor Information=\\(_Total\\)", + "Counters14": "Processor Information=\\([0-9,]+\\)\\\\% (C[0-9]+|Idle|Interrupt|Privileged|Processor|User) Time", "Counters15": "System=.", "Comments": "The counters defined are formatted as {category}={counter_match_expression}. The match expression is a regular expression to allow for handling variability of counters available on different systems. JSON content has eccentricities. Use 4-backslashes to represent a single backslash and 2-backslashes to represent a regular expression character escape." } diff --git a/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsPerformanceCounterMonitor.cs b/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsPerformanceCounterMonitor.cs index af9e1b54b4..c6cd631b83 100644 --- a/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsPerformanceCounterMonitor.cs +++ b/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsPerformanceCounterMonitor.cs @@ -73,9 +73,10 @@ public TimeSpan CounterDiscoveryInterval /// /// Defines the counter provider to use. Supported values: "Default" and "WMI". - /// When set to "Default", the monitor auto-selects WMI on systems with more than - /// 64 logical processors where the legacy .NET PerformanceCounter API fails. - /// When set to "WMI", the WMI provider is always used regardless of LP count. + /// When set to "Default" (or any value other than "WMI"), the .NET PerformanceCounter + /// API is used. When set to "WMI", the WMI provider is used. The provider is selected + /// strictly from this parameter; the monitor does not infer a provider from system + /// characteristics such as logical processor count. /// public string CounterProvider { @@ -91,21 +92,14 @@ public string CounterProvider protected virtual string CounterProviderName => this.UseWmiProvider ? "WMI" : ".NET SDK"; /// - /// Returns true when the WMI provider should be used, based on the CounterProvider - /// parameter and the system's logical processor count. + /// Returns true only when the parameter is explicitly + /// set to "WMI". No implicit/automatic selection is performed. /// protected bool UseWmiProvider { get { - if (string.Equals(this.CounterProvider, "WMI", StringComparison.OrdinalIgnoreCase)) - { - return true; - } - - // Auto-select WMI when the system has >64 logical processors. - // The legacy .NET PerformanceCounter API fails on these systems. - return Environment.ProcessorCount > 64; + return string.Equals(this.CounterProvider, "WMI", StringComparison.OrdinalIgnoreCase); } } diff --git a/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsWmiPerformanceCounterMonitor.cs b/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsWmiPerformanceCounterMonitor.cs index 3892edd8e6..786fde056f 100644 --- a/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsWmiPerformanceCounterMonitor.cs +++ b/src/VirtualClient/VirtualClient.Monitors/PerformanceCounters/WindowsWmiPerformanceCounterMonitor.cs @@ -14,14 +14,13 @@ namespace VirtualClient.Monitors /// /// Monitor captures performance counters from Windows systems using WMI - /// (CimSession querying Win32_PerfFormattedData_* classes). Required on - /// bare-metal systems with more than 64 logical processors where the legacy - /// .NET PerformanceCounter API fails. + /// (CimSession querying Win32_PerfFormattedData_* classes). Opt-in alternative + /// to the default .NET PerformanceCounter API path. /// /// /// This subclass always uses the WMI provider regardless of the CounterProvider - /// parameter or logical processor count. It can be referenced directly in profiles - /// as an alternative to setting CounterProvider=WMI on the base class. + /// parameter. It can be referenced directly in profiles as an alternative to + /// setting CounterProvider=WMI on the base class. /// public class WindowsWmiPerformanceCounterMonitor : WindowsPerformanceCounterMonitor { @@ -37,7 +36,7 @@ public WindowsWmiPerformanceCounterMonitor(IServiceCollection dependencies, IDic protected override string CounterProviderName => "WMI"; /// - /// Always uses WMI for counter discovery, bypassing the auto-detection logic. + /// Always uses WMI for counter discovery. /// protected override void LoadCounters(EventContext telemetryContext, CancellationToken cancellationToken) { From 45965595cbfc59bee0af7c1b8f260a0a0ce85798 Mon Sep 17 00:00:00 2001 From: Rakeshwar Reddy Kambaiahgari Date: Wed, 27 May 2026 09:04:58 -0700 Subject: [PATCH 3/3] UpVersion --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index df4bdc7e53..0fa4ae4890 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.9 \ No newline at end of file +3.3.0 \ No newline at end of file