perf(telemetry): reduce idle resource monitoring CPU - #5345
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved a94c104 Performance optimization that reduces CPU usage by applying consistent 5-second background polling intervals, sharing timers across React components, and limiting expensive process metadata refreshes to tracked processes only. Changes are self-contained with clear intent and appropriate test updates. You can customize Macroscope's approvability policy. Learn more. |
Summary
Why
The always-on telemetry path repeatedly scanned and refreshed process data, while mounted UI consumers created duplicate timers. Those redundant periodic tasks consumed CPU while the app was idle.
Validation
cargo fmt --check --manifest-path native/resource-monitor/Cargo.tomlcargo test --locked --manifest-path native/resource-monitor/Cargo.toml(15 passed)./node_modules/.bin/vp test run apps/server/src/resourceTelemetry/NativeTelemetryClient.test.ts(10 passed)This PR is separate from the large-thread synchronization batching PR.
Note
Reduce idle CPU usage in resource monitoring and UI polling
resolveNativeSampleIntervalMsnow returns a 5,000ms interval when there are no live diagnostic subscribers instead of always using 1,000ms.useRelativeTimeTickanduseDesktopLocalBootstrapsare rewritten withuseSyncExternalStoreso multiple consumers share a single timer/polling loop that stops when there are no subscribers.Macroscope summarized a94c104.