sysfs: skip disabled thermal zones before reading temp#793
Closed
realgagangupta wants to merge 2 commits intoprometheus:masterfrom
Closed
sysfs: skip disabled thermal zones before reading temp#793realgagangupta wants to merge 2 commits intoprometheus:masterfrom
realgagangupta wants to merge 2 commits intoprometheus:masterfrom
Conversation
Disabled thermal zones return EINVAL when their temp file is read, causing the entire thermal_zone collector to fail even for healthy zones. Fix by reading the mode file first in parseClassThermalZone(). If the zone is disabled, return early with os.ErrProcessDone which the caller already handles by skipping to the next zone. Fixes: prometheus/node_exporter#2980 Signed-off-by: Gagan Gupta <realgagangupta@users.noreply.github.com>
Add thermal_zone2 fixture with mode=disabled and no temp file to simulate a disabled zone. Update TestClassThermalZoneStats to verify that disabled zones are skipped and do not appear in results. Signed-off-by: Gagan Gupta <realgagangupta@users.noreply.github.com>
183ffd9 to
34f4020
Compare
Member
|
I don't think this is actually correct. The |
Author
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.
Problem
Disabled thermal zones return
EINVALwhen theirtempfile is read. This causes the entirethermal_zonecollector to fail with:Even healthy/enabled zones stop reporting metrics because one disabled zone crashes the whole loop.
Root Cause
parseClassThermalZonereads themodefile after readingtemp. For disabled zones, readingtempfails withEINVALbefore we ever check the mode.Fix
Read
modefirst inparseClassThermalZone. If the zone is"disabled", returnos.ErrProcessDoneearly — before attempting to readtemp. The caller skips on this sentinel and continues to the next zone.Related