Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sensors - ReadingRangeMax type float64 instead of type float32 #361

Closed
rachmurali02 opened this issue Sep 25, 2024 · 1 comment · Fixed by #362
Closed

Sensors - ReadingRangeMax type float64 instead of type float32 #361

rachmurali02 opened this issue Sep 25, 2024 · 1 comment · Fixed by #362

Comments

@rachmurali02
Copy link

Hi,

I encountered an issue earlier today while working on an API to get sensors.

When extracting data for all sensors, the ReadingRangeMax value for some sensors is too large to be processed in the Go struct from the library. I can't ignore specific sensors because the process retrieves all sensors, deconstructs the data using the GoFish library's built-in API, and extracts the relevant information.

While I can choose not to output the data, I’m not sure how to block its processing due to how the underlying API is constructed. Although the actual readings are typically around 157 for most sensors, the maximum limit is set to "ReadingRangeMax": 1.7976931348623157e+308. The API hangs on this max value and doesn't proceed for those instances, as it doesn’t parse them.

For example, when requesting one of the PMT_Socket objects, the ReadingRangeMax is "1.7976931348623157e+308". This is the max value for float64, but the Go struct in the API uses a float32 for ReadingRangeMax.

ReadingRangeMax float32

{
"@odata.id": "/redfish/v1/Chassis/chassis/Sensors/count_PMT_Socket0_Core7_CSTATE_RESIDENCY_C0",
"@odata.type": "#Sensor.v1_2_0.Sensor",
"Id": "count_PMT_Socket0_Core7_CSTATE_RESIDENCY_C0",
"Name": "PMT Socket0 Core7 CSTATE RESIDENCY C0",
"Reading": 157.78590568,
"ReadingRangeMax": 1.7976931348623157e+308,
"ReadingRangeMin": 0.0,
"ReadingUnits": "Units",
"Status": {
"Health": "OK",
"State": "Enabled"
}
}
Would you be interested in updating it to use float64, given that we have a BMC instance returning the max float64 value for the “ReadingRangeMax” field.

Best,
Rachana Murali Narayanan

@stmcginnis
Copy link
Owner

Thanks for pointing this out!

The spec isn't always too clear on number ranges, so I know we've had a few of these where it's been found to need a much larger type. I'll put up an update for the ReadingRangeMax. Just let me know if you run in to any others like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants