Dont check for temperatures in /thermal_zone where mode=disabled#694
Open
Saumya40-codes wants to merge 1 commit intoprometheus:masterfrom
Open
Dont check for temperatures in /thermal_zone where mode=disabled#694Saumya40-codes wants to merge 1 commit intoprometheus:masterfrom
Saumya40-codes wants to merge 1 commit intoprometheus:masterfrom
Conversation
Signed-off-by: Saumyacodes-40 <saumyabshah90@gmail.com>
SuperQ
reviewed
Jan 17, 2025
| return ClassThermalZoneStats{}, err | ||
| } | ||
|
|
||
| if strings.TrimSpace(modeContent) == "disabled" { |
Member
There was a problem hiding this comment.
Typically we avoid making decisions like this in the library. Rather, we simply expose the mode as a raw attribute and allow the downstream consumer to decide what to do.
Author
There was a problem hiding this comment.
Ohkk
Maybe thats something which can be handled from node exporter itself only?
here, as was stated in main issue, we check while reading the Zone temp and if the error turns out to be of type os.ErrInvalid then we can return an empty struct (and return an error when necessary (i.e. in the case of os.IsNotExist(err) && os.IsPermission(err)
Member
There was a problem hiding this comment.
Yes, we may need to refactor that error handling.
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.
Relevant issue
Fixes: prometheus/node_exporter#2980
Current behaviour
node_exporterchecks for the contents oftempfile even whenmodeis disabled due to which in the case when temp file contains a non desired value thethermal_zonecollector fails and no longer gives its related metricsProposed solution
modeis set to disabledTesting
github.com/prometheus/procfsinnode_exportergo.modto local dev setup ofprocfsand comparing the results in bothcc: @discordianfish