发布

  • fix(core): upgrade sysinfo to 0.37.2 and fix cpu measurement accuracy (#34101)

    frostbyte_neo 发布于 2026-01-14 18:40:22 +00:00

    Current Behavior

    CPU metrics collection can report inaccurate values where:

    • Individual processes show inflated CPU usage
    • Total CPU aggregation across all processes exceeds the system's
      maximum available CPU
    • This leads to confusing and misleading metrics data

    Expected Behavior

    CPU metrics accurately reflect actual resource usage:

    • Process CPU values are accurate
    • Total CPU aggregation stays within system limits
    • Metrics data is reliable and trustworthy

    Additional Notes

    • Root cause: When registering a new process, we established a CPU
      baseline by refreshing only that single process via sysinfo.
      Internally, sysinfo calculates CPU% as (process_cpu_time_delta / wall_time_delta) * 100. Refreshing a single process updates the wall
      time reference but leaves the CPU time baselines of other processes
      unchanged. In the next metrics collection, these other processes appear
      to have consumed their CPU time over a shorter wall time period (based
      on the last baseline), resulting in inflated percentages (e.g., 200%+
      for single-threaded processes).
    • This PR also improves initialization performance by only loading
      necessary system data (processes, CPU, memory) instead of all system
      information
    • Upgrades sysinfo dependency to v0.37.2, which includes upstream CPU
      measurement improvements.

    Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>

    下载附件