Skip to content

(PE-40346) Fix retrieve_additional_metrics error handling #205

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

Merged

Conversation

Sharpie
Copy link
Member

@Sharpie Sharpie commented Feb 12, 2025

This commit adds a guard clause to the retrieve_additional_metrics
function in pe_metrics.rb that ensures the data returned from the
/metrics API is of type Array.

Non-conforming data is logged to stderr along with the URL queried
as non-Array responses typically contain error messages that inform
why the request failed.

Conversion to JSON prior to making a HTTP request was not the error
reported in SUP-5232. JSON responses that did not contain Array
bodies were the cause of the issue.

This reverts commit 05cf01b.
This commit adds a guard clause to the `retrieve_additional_metrics`
function in `pe_metrics.rb` that ensures the data returned from the
`/metrics` API is of type Array.

Non-conforming data is logged to stderr along with the URL queried
as non-Array responses typically contain error messages that inform
why the request failed.
@Sharpie Sharpie force-pushed the PE-40346-fix-pe_metrics-error-handling branch from 1b37c06 to 137a00c Compare February 12, 2025 22:24
@Sharpie Sharpie merged commit b40c259 into puppetlabs:main Feb 14, 2025
25 checks passed
@Sharpie Sharpie deleted the PE-40346-fix-pe_metrics-error-handling branch February 14, 2025 20:30
@Sharpie Sharpie added the bugfix label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants