Implement and fix Windows disk metrics parsing by HTHou · Pull Request #17290 · apache/iotdb

Pull request overview

This PR adds Windows-specific implementations for collecting system metrics so disk, network, and file-handle-related metrics can be reported consistently across OSes.

Changes:

  • Implement Windows network metrics collection via PowerShell (Get-NetAdapter, Get-NetAdapterStatistics) and netstat parsing.
  • Implement Windows disk metrics collection via PowerShell CIM perf counters and accumulate sampled per-second values into cumulative totals.
  • Add Windows support for “open file handlers” by querying the current process handle count via Windows API (JNA).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.

File Description
iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/net/WindowsNetMetricManager.java Implements Windows network interface + connection metrics via command execution and parsing.
iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/WindowsDiskMetricsManager.java Implements Windows disk and process IO metrics by sampling Win32 perf counters using PowerShell.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/file/SystemRelatedFileMetrics.java Extends open-file/handle metrics support to Windows using JNA and kernel32.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.