Dont check for temperatures in /thermal_zone where mode=disabled#694
Dont check for temperatures in /thermal_zone where mode=disabled#694Saumya40-codes wants to merge 1 commit intoprometheus:masterfrom
Conversation
Signed-off-by: Saumyacodes-40 <saumyabshah90@gmail.com>
| return ClassThermalZoneStats{}, err | ||
| } | ||
|
|
||
| if strings.TrimSpace(modeContent) == "disabled" { |
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.
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)
There was a problem hiding this comment.
Yes, we may need to refactor that error handling.
|
I'm thinking about #794 isntead. This error refactor allows us to always read as much as we can from a thermal zone. |
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