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

Handle different response in storage data for redfish api #71

Conversation

chanchiwai-ray
Copy link
Contributor

@chanchiwai-ray chanchiwai-ray commented Apr 24, 2024

@chanchiwai-ray chanchiwai-ray requested a review from a team as a code owner April 24, 2024 08:35
Copy link
Contributor

@jneo8 jneo8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking question.

prometheus_hardware_exporter/collectors/redfish.py Outdated Show resolved Hide resolved
@chanchiwai-ray
Copy link
Contributor Author

Encounter this also microsoft/linux-package-repositories#130

Copy link
Contributor

@dashmage dashmage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! This probably resolves #177, but I'm not sure about #222, #69. For those, we might have to check with the bug reporters themselves and see if the redfish API uses Controllers there as well or if it's something else altogether to fetch the storage controller info.

#115 seems like the standard case but not sure why there's still an error.

prometheus_hardware_exporter/collectors/redfish.py Outdated Show resolved Hide resolved
tests/unit/test_redfish.py Outdated Show resolved Hide resolved
@chanchiwai-ray chanchiwai-ray requested a review from dashmage April 25, 2024 01:57
@chanchiwai-ray chanchiwai-ray requested review from Pjack and jneo8 April 25, 2024 02:02
@chanchiwai-ray
Copy link
Contributor Author

chanchiwai-ray commented Apr 25, 2024

but I'm not sure about canonical/hardware-observer-operator#222, #69. For those, we might have to check with the bug reporters themselves and see if the redfish API uses Controllers there as well or if it's something else altogether to fetch the storage controller info.

Agree. That can be an enhancement proposal from them if they require it, or they find out more possible "keys". But at least they will not see the KeyError after this.

canonical/hardware-observer-operator#115 seems like the standard case but not sure why there's still an error.

Same here, they will not see KeyError after this, but with more debugging information, so that user can propose enhancement, instead of reporting KeyError which is not informative

@chanchiwai-ray chanchiwai-ray requested a review from jneo8 April 25, 2024 04:27
Copy link
Contributor

@dashmage dashmage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀 Thanks for addressing my comments! Also, adding the extra else block and fetching data from the dict properly to ensure there's no KeyError related errors is a great idea.

@chanchiwai-ray chanchiwai-ray merged commit 5f33417 into canonical:main Apr 25, 2024
3 checks passed
@chanchiwai-ray chanchiwai-ray deleted the bug/KeyError/bseng-2379,bseng-2353,bseng-1785,bseng-2091 branch April 25, 2024 05:56
chanchiwai-ray added a commit to chanchiwai-ray/prometheus-hardware-exporter that referenced this pull request Apr 29, 2024
Set the "Health" key to a string of "NA" when it's not present.
chanchiwai-ray added a commit that referenced this pull request Apr 29, 2024
* Fix regression from #71.

Set the "Health" key to a string of "NA" when it's not present.

* Add unit test for missing "Health" key.

Co-authored-by: Ashley James <[email protected]>
@Pjack Pjack linked an issue May 2, 2024 that may be closed by this pull request
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 this pull request may close these issues.

Handle different storage controller responses
5 participants