Repository navigation
fix(npu): alert on the temperature both interfaces already ask for - #3718
Merged
Merged
Conversation
update_views() replaced the base class's per-field views with a dict naming only load, freq and mem, so views[npu_id]['temperature'] did not exist. Both readers then fell back to no style: msg_curse's get_views() returns 'DEFAULT' for a missing key, and the WebUI's getDecoration returns undefined. An Intel NPU -- the one driver that reports the reading -- was printed plain at any temperature. Adds the key and the alert, mirroring the GPU plugin, which has had the same three alerts (proc/mem/temperature) all along. A card whose driver leaves the reading None (AMD, Rockchip) keeps a view with no decoration rather than being alerted on nothing. conf/glances.conf gains the matching [npu] temperature thresholds, using the same 60/70/80 ladder as [gpu]: without limits get_alert() returns DEFAULT, so the code half alone would change nothing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The NPU plugin's temperature is never alerted, in either interface, at any reading.
update_views()does not extend the views the base class built — it replaces them:temperatureis not in that dict, soviews[npu_id]['temperature']does not exist, and both readers fall back to no style:msg_curseasksget_views(item=..., key='temperature', option='decoration')(npu/__init__.py:249), andget_viewsreturns the string'DEFAULT'for a key it cannot find.plugin-npu.vue:35callsgetDecoration(npu.npu_id, 'temperature'), whose first line returnsundefinedwhen the view is missing, so no class is bound.Both sides were written expecting a decoration that nothing produces. The reading itself is real:
cards/intel.py:82sets it from the driver (temp_value / 1000.0); AMD and Rockchip document it as not implemented and leave itNone.The sibling GPU plugin has had all three alerts —
proc,mem,temperature— since it was written, so this is the NPU plugin missing one its own callers assume, not a feature neither has.The change
Adds
'temperature': {}to the view dict and the alert beside the other three, in the GPU plugin's shape. A card that reports no reading keeps an empty view rather than being alerted onNone, whichget_alertwould otherwise score through(None * 100) / 100.conf/glances.confgains the matching[npu]thresholds on the same 60/70/80 ladder[gpu]uses. That half is not cosmetic: with no limits configured,get_alerttakes itsnot careful and not warning and not criticalbranch and returns'DEFAULT', so the code change alone would be invisible.I did not add
mem_*thresholds to[npu], althoughupdate_viewscomputes amemalert that is unconfigured for the same reason. Leaving a stat unthresholded is a normal default across the plugins; temperature is different only because two call sites already read a style for it.Verification
pytest tests/test_plugin_npu.pyis 13 passed (new file); withtest_plugin_gpu.pyandtest_plugin_quicklook.py, 56 passed / 9 skipped.ruff checkandruff format --checkare clean.Each half was checked by reverting it:
'temperature'dropped from the view dict (the shape ondevelop)[npu]thresholds removed fromconf/glances.confThe last row is why the config assertions exist at all: without them the code change could be reverted in
conf/glances.confalone and every behavioural test would still pass while the alert stayed invisible.I have no NPU to hand, so the assertions drive
update_viewsover a synthetic card rather than a real one.