pmdalmsensors: query only the requested chip during metric fetch - #2665
pmdalmsensors: query only the requested chip during metric fetch#2665Ali-Nasrolahi wants to merge 1 commit into
Conversation
The lmsensors PMDA currently executes a full `sensors -j` scan for
every metric fetch, even though only a single metric value is
requested. Since each invocation probes all detected sensor chips,
the same hardware is repeatedly queried while serving a single PCP
fetch request.
Store the original lm_sensors chip name during metric discovery and
use it to query only the chip associated with the requested metric.
This preserves the existing fetch semantics while avoiding redundant
probing of unrelated hardware.
The change reduces the amount of work performed per metric fetch and
improves scalability on systems exposing many sensor devices or slow
sensor backends.
Signed-off-by: Ali Nasrollahi <A.Nasrolahi01@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Repository UI (inherited), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
Walkthrough
Changeslm_sensors chip scoping
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
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 |
PMDA lmsensors: Reduce redundant sensor probing during metric fetches
Patch Description
This patch optimizes the
lmsensorsPMDA by avoiding redundant full-system sensor scans when serving metric fetchrequests. Currently, every metric fetch executes
sensors -jwhich probes all sensor chips, even though only asingle metric value is ultimately returned. As a result, a PCP fetch involving multiple metrics repeatedly re-reads the
same hardware. This patch records the originating lm_sensors chip for each metric during PMDA initialization and uses
that information to query only the chip associated with the requested metric.
In other words, instead of executing
sensors -j, we runsensors -j <chip>which reduces the amount of work that isneeded.
Additionally, the cost with current implementation grows with:
Related Issue
While investigating why the PMDA was occasionally timing out, I found that one sensor backend on my system requires
roughly half a second to respond. Because the PMDA executes a full
sensors -jinvocation for every metric, the latencycombined across all requested metrics, which then exceeded the PMCD request timeout and causing all metrics in the
request to fail. Since only one metric value is needed for each callback, querying only the corresponding sensor chip
avoids repeatedly waiting on unrelated hardware.
For the context, my environment is Fedora 44 with PCP 7.1.5:
Warm Regards,
Ali :)